From patchwork Wed Sep 26 11:36:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 10615821 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7379D913 for ; Wed, 26 Sep 2018 11:55:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 641B326B41 for ; Wed, 26 Sep 2018 11:55:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 572C92A992; Wed, 26 Sep 2018 11:55:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A7442A987 for ; Wed, 26 Sep 2018 11:55:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 162BA8E0016; Wed, 26 Sep 2018 07:55:14 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 113138E000F; Wed, 26 Sep 2018 07:55:14 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAD9F8E0016; Wed, 26 Sep 2018 07:55:13 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) by kanga.kvack.org (Postfix) with ESMTP id B9E2A8E000F for ; Wed, 26 Sep 2018 07:55:13 -0400 (EDT) Received: by mail-io1-f70.google.com with SMTP id s5-v6so52117825iop.3 for ; Wed, 26 Sep 2018 04:55:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:message-id:user-agent:date:from :to:cc:subject:references:mime-version; bh=3ULS8xakk5PjFAR+8tJXFiitZhxMy7nnK13h1c+fJV4=; b=ScxEafhqPvFooLov2oprTdy+Rr85TR4OO/Njh2qegdg3viXJTx2GtFYvkpG7SMutxo uImuZYYaUFPodi4PxGFY/me9QxoHJB/QHL3zHPcYow8/rqoCPJkVBH0+Yt7HI0q3lrBi xLhV3M81f/W6euVwwCocVj5Qt9KNnX6dS+tHgkNpz2PTBgPQ69zwlMaevqofkcR2u4IJ KSoxhowCgmkJyH4/9BBdjpIJjd4h1dzxrcr3UgVBHwB5akVGiDLZJOOXxPpyZzYXstEc yEmu1W/s3irKQmXKTb3luFmJQ7+gx3/s+cUnmXPMMNy+2E+o2fcrgLDZls2Gzqp1rLOY g4wg== X-Gm-Message-State: ABuFfohpbXcYDKu3wj4fTYJay7Av2w+wt67U/QFAmQd9pnfVcM3FSwFV E23w3uYcDZp4Giyy9oBND0xtPOsFmyMZbAByFTezV8aMcdymN2thDGEFYrb9c74BcM00Bud1XZA HC8Cvi9mPMe2Gmio6lLaCmspGh9HyTRj2LH5Auu2jBuL0MjjwAr6tgdgEK9nB6cGSuA== X-Received: by 2002:a24:bd41:: with SMTP id x62-v6mr4358290ite.152.1537962913459; Wed, 26 Sep 2018 04:55:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV60F5+XKlTIgCckvBc0cMW2tW8ARYoKtd79vQU+4/PEYyyBQSquptqB/g8yUTfg//7L+FKZY X-Received: by 2002:a24:bd41:: with SMTP id x62-v6mr4358239ite.152.1537962912437; Wed, 26 Sep 2018 04:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537962912; cv=none; d=google.com; s=arc-20160816; b=h4XJvh4FhgUt2vBQzgbvHa8DiJYbKSBsZgNLlGOhPejH8weWBWYF2lGsd3ZKgDkV/Q 95FKhtYApsBlMFhgLoy4ufW1OTtp+W8ZYrlurHiLPoyHd+hzs0Gu+6gAvgnRhhSPa/If zjp8vItqHSGzyXkNSQh84406rbWQQdN9Ksy+oi17ny7Nr3YUo/Rz14uvHaza+63/EKF+ 2d5MFMWkoTvjUp2JjHyvn+Wh6uAtS0RA2MlCYS39dfSh5hS1whKtBpio/8o+R+BFMuM0 rtn43DnSdBdmWKHey2MvZ1jlpGSQtefgIEwLxzOLbVx86pOPUaOFv/MThsWveW1aLmuc 6wUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:references:subject:cc:to:from:date:user-agent :message-id:dkim-signature; bh=3ULS8xakk5PjFAR+8tJXFiitZhxMy7nnK13h1c+fJV4=; b=G24gU4z/NIPRznIQ8DUmm3FODmISxD21itdwVXIm2hJLW0vEMrWVrM/nMdZ8MQC70W Ka7l2c6oSDwDqKzlo4bdh2cAPj0C56NVe6HuLYjiUVdJqKN9Fl1oG5DJlzlm6qEwC085 J4FXy0mHJA3OmaDtRRUwFV0qCbpLVZBP66FYY5dAve48QKtXLlHd9eTnB7jqm8HSpHCi XpGmz+xGeuFdBQMfFg5rGA4wuBZhY/u4Gso9hCFFUXXb5Vh9kKEwnJZhRMfF+d4H+bPx TJK0oaTwZNrYXnjh5Hee++RmzMrRD9cI5za2mTJNb29y3wtVNHqimZBW+0Wv6u4HtGOn +9HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=q0sErcDE; spf=pass (google.com: best guess record for domain of peterz@infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) smtp.mailfrom=peterz@infradead.org Received: from merlin.infradead.org (merlin.infradead.org. [2001:8b0:10b:1231::1]) by mx.google.com with ESMTPS id b6-v6si2349054jam.65.2018.09.26.04.55.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 04:55:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of peterz@infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) client-ip=2001:8b0:10b:1231::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=q0sErcDE; spf=pass (google.com: best guess record for domain of peterz@infradead.org designates 2001:8b0:10b:1231::1 as permitted sender) smtp.mailfrom=peterz@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3ULS8xakk5PjFAR+8tJXFiitZhxMy7nnK13h1c+fJV4=; b=q0sErcDEJDK+u+Ku5DIDNK3SEs WsjoR0HSlVdufw8byMr4LzGTmCpO8hXsMhrVvvnQvzGjIbGXpfrj39OcWhWWOaD6Fb4O/zVCeEs0N DNg2h5adaU4nm/Org0E2lpQtXIUGtUUnBsRcaN4P5CjDWxyZDKpAF3n1atbPNe0k2uKs2u/2AOhH7 Y044Vl9WXefdTfjF/daNYD2PTKpVQpC/nEen9aeXuMZ3yju3gLL41mz4Ie7qX+qcmGkQzcibzM1FA 5jnNt24XmNhldoGRmZAo8LQT7bsv/RwQj/UFMGXpCk4rSE70Gvl9r1ixDnCbZzgjQ+eEknqXtwUgo lGXQn1IA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g58Oy-0007Un-0e; Wed, 26 Sep 2018 11:55:04 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id B2BCC206F1820; Wed, 26 Sep 2018 13:54:04 +0200 (CEST) Message-ID: <20180926114801.314124744@infradead.org> User-Agent: quilt/0.65 Date: Wed, 26 Sep 2018 13:36:38 +0200 From: Peter Zijlstra To: will.deacon@arm.com, aneesh.kumar@linux.vnet.ibm.com, akpm@linux-foundation.org, npiggin@gmail.com Cc: linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, peterz@infradead.org, linux@armlinux.org.uk, heiko.carstens@de.ibm.com, riel@surriel.com Subject: [PATCH 15/18] asm-generic/tlb: Remove arch_tlb*_mmu() References: <20180926113623.863696043@infradead.org> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Now that all architectures are converted to the generic code, remove the arch hooks. Signed-off-by: Peter Zijlstra (Intel) --- mm/mmu_gather.c | 93 +++++++++++++++++++++++++------------------------------- 1 file changed, 42 insertions(+), 51 deletions(-) --- a/mm/mmu_gather.c +++ b/mm/mmu_gather.c @@ -93,33 +93,6 @@ bool __tlb_remove_page_size(struct mmu_g #endif /* HAVE_MMU_GATHER_NO_GATHER */ -void arch_tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, - unsigned long start, unsigned long end) -{ - tlb->mm = mm; - - /* Is it from 0 to ~0? */ - tlb->fullmm = !(start | (end+1)); - -#ifndef CONFIG_HAVE_MMU_GATHER_NO_GATHER - tlb->need_flush_all = 0; - tlb->local.next = NULL; - tlb->local.nr = 0; - tlb->local.max = ARRAY_SIZE(tlb->__pages); - tlb->active = &tlb->local; - tlb->batch_count = 0; -#endif - -#ifdef CONFIG_HAVE_RCU_TABLE_FREE - tlb->batch = NULL; -#endif -#ifdef CONFIG_HAVE_MMU_GATHER_PAGE_SIZE - tlb->page_size = 0; -#endif - - __tlb_reset_range(tlb); -} - void tlb_flush_mmu_free(struct mmu_gather *tlb) { #ifdef CONFIG_HAVE_RCU_TABLE_FREE @@ -136,27 +109,6 @@ void tlb_flush_mmu(struct mmu_gather *tl tlb_flush_mmu_free(tlb); } -/* tlb_finish_mmu - * Called at the end of the shootdown operation to free up any resources - * that were required. - */ -void arch_tlb_finish_mmu(struct mmu_gather *tlb, - unsigned long start, unsigned long end, bool force) -{ - if (force) { - __tlb_reset_range(tlb); - __tlb_adjust_range(tlb, start, end - start); - } - - tlb_flush_mmu(tlb); - - /* keep the page table cache within bounds */ - check_pgt_cache(); -#ifndef CONFIG_HAVE_MMU_GATHER_NO_GATHER - tlb_batch_list_free(tlb); -#endif -} - #endif /* HAVE_GENERIC_MMU_GATHER */ #ifdef CONFIG_HAVE_RCU_TABLE_FREE @@ -258,10 +210,40 @@ void tlb_remove_table(struct mmu_gather void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) { - arch_tlb_gather_mmu(tlb, mm, start, end); + tlb->mm = mm; + + /* Is it from 0 to ~0? */ + tlb->fullmm = !(start | (end+1)); + +#ifndef CONFIG_HAVE_MMU_GATHER_NO_GATHER + tlb->need_flush_all = 0; + tlb->local.next = NULL; + tlb->local.nr = 0; + tlb->local.max = ARRAY_SIZE(tlb->__pages); + tlb->active = &tlb->local; + tlb->batch_count = 0; +#endif + +#ifdef CONFIG_HAVE_RCU_TABLE_FREE + tlb->batch = NULL; +#endif +#ifdef CONFIG_HAVE_MMU_GATHER_PAGE_SIZE + tlb->page_size = 0; +#endif + + __tlb_reset_range(tlb); inc_tlb_flush_pending(tlb->mm); } +/** + * tlb_finish_mmu - finish an mmu_gather structure + * @tlb: the mmu_gather structure to finish + * @start: start of the region that will be removed from the page-table + * @end: end of the region that will be removed from the page-table + * + * Called at the end of the shootdown operation to free up any resources that + * were required. + */ void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) { @@ -272,8 +254,17 @@ void tlb_finish_mmu(struct mmu_gather *t * the TLB by observing pte_none|!pte_dirty, for example so flush TLB * forcefully if we detect parallel PTE batching threads. */ - bool force = mm_tlb_flush_nested(tlb->mm); + if (mm_tlb_flush_nested(tlb->mm)) { + __tlb_reset_range(tlb); + __tlb_adjust_range(tlb, start, end - start); + } - arch_tlb_finish_mmu(tlb, start, end, force); + tlb_flush_mmu(tlb); + + /* keep the page table cache within bounds */ + check_pgt_cache(); +#ifndef CONFIG_HAVE_MMU_GATHER_NO_GATHER + tlb_batch_list_free(tlb); +#endif dec_tlb_flush_pending(tlb->mm); }