From patchwork Wed Sep 26 11:36:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 10615819 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 8E9F014BD for ; Wed, 26 Sep 2018 11:55:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81DD22A98A for ; Wed, 26 Sep 2018 11:55:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 761A12A995; Wed, 26 Sep 2018 11:55:45 +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 6265A2A98A for ; Wed, 26 Sep 2018 11:55:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F8238E0015; Wed, 26 Sep 2018 07:55:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 752218E000F; Wed, 26 Sep 2018 07:55:12 -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 5F1E38E0015; Wed, 26 Sep 2018 07:55:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it1-f199.google.com (mail-it1-f199.google.com [209.85.166.199]) by kanga.kvack.org (Postfix) with ESMTP id 2E53C8E000F for ; Wed, 26 Sep 2018 07:55:12 -0400 (EDT) Received: by mail-it1-f199.google.com with SMTP id k143-v6so2718478ite.5 for ; Wed, 26 Sep 2018 04:55:12 -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=AJ/FeihIS/WiUtEfjDbg6CRgoMVGPUxLj7TmPmBEqU8=; b=oHhsjsoEVaDboj7MtjzfEFbnU77VaQZMRrbmoyKPsKikTbzDDhCjqJC5d7qJyeSj9q UVg06vQjtTJQL0nSNKlmljVG50XFhR9Y4hBR/FRGWgWEgrwhyZRFM83oGMVpljvQLg0N zTjOXBck7csmZdekKOx0TR7WrNEd1LAYMr7ImwpnZeEHrY8cQzTiZBqgg889jXXrtkf+ Obqj2Gw9o3K85WrMHAu/JRFe9zG0/zomW37Y+gblDocTJXBhlPs6cmNvPtnQlfQj36xK pVzA23RJgl87obA3cvvhzZ65sao+DhjN7gJCAmqPIGO91eaKtiuLyBkylKZoT7NCg3gj 3OdQ== X-Gm-Message-State: ABuFfojs6vQi45yAIC1MPERLFHvQv649Rqym4UXMOCIWFL9Nzx0odEWB gMfNvjPwzEM9RsSCQ/A+zoQYbQANV3wodtLkqAz/uEl/CCbtaDsoZZg9MLjIGwZccLzHQfyMOZn CnPU30aDRU4p4UPJSHF6dA9ssqp2TqWmF8SCAwH1HbWbUwKVpnguCb2qA/gMZOMJ0Ag== X-Received: by 2002:a24:7012:: with SMTP id f18-v6mr4428390itc.87.1537962911964; Wed, 26 Sep 2018 04:55:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV61LYsL3ncXaqj7kts412BCBnvffl+YpbnlCxfhPTiM2KYd32jZ9fW0s//plIrv1VfDeIrw9 X-Received: by 2002:a24:7012:: with SMTP id f18-v6mr4428361itc.87.1537962911260; Wed, 26 Sep 2018 04:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537962911; cv=none; d=google.com; s=arc-20160816; b=rHYh1z7RCBVR2RyrjtCP5/GyR8G78M6EQGG0B33RKbInoz4ODXNsGZ2L0t320pL3R4 0EbHlA7IObltRYi9ORZREroKpTjaQhlQPgjZW8QO5t9wq5NLMr2PvsUTH/vcXBM3Ub/o TWho8uQe4K5hjsMZRN+CsFGEuVFx6Dcjk8+fZjQe+ixn8nnH8jDtEsn7KUIUjgx8IVfB 5H4FkU3CNj6icLbjIRgoEIi66+ygBwhLhm9qjtuLRQZTrIdsftw8R38M5/khnt2umwl0 JHFY9afbsIBUEQL3/as8zzzBHyURXetRkX/LcWImIdLqnNvAovioi8BwLf1wmXig3L7f 4oxA== 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=AJ/FeihIS/WiUtEfjDbg6CRgoMVGPUxLj7TmPmBEqU8=; b=ssALGNCvjzMQRkFKFQ+g23HyFCExks+fASceCM3d5JyJTlJ1ZKf2ptCB8ZL7We8OJU ECDH1YCAQKqMNQHsrZlAYGH9s+gMocN2WkYe+dV8KLNDqra0G8TQw7d5pW+3hrASYZg/ 2o1T73PgOeH991rW5NFsW73W/aN0/9/LqpAWTXm7tfZXA0sGuy/bHRxQjc4uvcAWHQic U1RvRgpuPGorNaP4eRSjVaQPMhSZAC6hQzWB+eNQbhAr4v5lp8dcpdwl8xXyNFBDfYZ/ ry/Nejs8bCGGRZ1y749IM8ETEIv/mP/NYc+rdu5aPlE/Lxg2ZRfNXPNtsWwmouAGrvm4 2QXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=SKVl8yeC; 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 c3-v6si3020674iod.59.2018.09.26.04.55.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 04:55:11 -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=SKVl8yeC; 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=AJ/FeihIS/WiUtEfjDbg6CRgoMVGPUxLj7TmPmBEqU8=; b=SKVl8yeCprFBC/uN3i/cyFvKUt XarrrRHP42O9ay5qHsxYQofUAs52UA+0BleMRp8+GLZGETe9OzGhwyQZFpwmvN7lzPo1MPwRlXymn b2ulcMeUrOrgQuvVRx6d9EdloryH+etBGbag9jzzgIa9zYN0fJ1Qm7/fzhTUkhmSlUMkic4Z9ZHoC 5IHV4ALZh3gEgZiGYCbI4DjzL1MkP726VsTRPJqJjbHbzZfIjPnpZHrh6SGaQRZYcDw+Tqh/gEpDG YgQlMeOfYyv3gHf2FOp3u4DhunMmij1kOW3caAbqNTuV5PiEOXhcAoWGrW4By3KZPn+QkYKIa9pri oR4mCrlQ==; 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-0007Up-23; Wed, 26 Sep 2018 11:55:04 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 0) id C1B02206F1836; Wed, 26 Sep 2018 13:54:04 +0200 (CEST) Message-ID: <20180926114801.417460864@infradead.org> User-Agent: quilt/0.65 Date: Wed, 26 Sep 2018 13:36:40 +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 17/18] asm-generic/tlb: Remove tlb_flush_mmu_free() 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 As the comment notes; it is a potentially dangerous operation. Just use tlb_flush_mmu(), that will skip the (double) TLB invalidate if it really isn't needed anyway. Signed-off-by: Peter Zijlstra (Intel) --- include/asm-generic/tlb.h | 10 +++------- mm/memory.c | 2 +- mm/mmu_gather.c | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -67,16 +67,13 @@ * call before __tlb_remove_page*() to set the current page-size; implies a * possible tlb_flush_mmu() call. * - * - tlb_flush_mmu() / tlb_flush_mmu_tlbonly() / tlb_flush_mmu_free() + * - tlb_flush_mmu() / tlb_flush_mmu_tlbonly() * * tlb_flush_mmu_tlbonly() - does the TLB invalidate (and resets * related state, like the range) * - * tlb_flush_mmu_free() - frees the queued pages; make absolutely - * sure no additional tlb_remove_page() - * calls happen between _tlbonly() and this. - * - * tlb_flush_mmu() - the above two calls. + * tlb_flush_mmu() - in addition to the above TLB invalidate, also frees + * whatever pages are still batched. * * - mmu_gather::fullmm * @@ -274,7 +271,6 @@ void arch_tlb_gather_mmu(struct mmu_gath void tlb_flush_mmu(struct mmu_gather *tlb); void arch_tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end, bool force); -void tlb_flush_mmu_free(struct mmu_gather *tlb); static inline void __tlb_adjust_range(struct mmu_gather *tlb, unsigned long address, --- a/mm/memory.c +++ b/mm/memory.c @@ -1155,7 +1155,7 @@ static unsigned long zap_pte_range(struc */ if (force_flush) { force_flush = 0; - tlb_flush_mmu_free(tlb); + tlb_flush_mmu(tlb); if (addr != end) goto again; } --- a/mm/mmu_gather.c +++ b/mm/mmu_gather.c @@ -91,7 +91,7 @@ bool __tlb_remove_page_size(struct mmu_g #endif /* HAVE_MMU_GATHER_NO_GATHER */ -void tlb_flush_mmu_free(struct mmu_gather *tlb) +static void tlb_flush_mmu_free(struct mmu_gather *tlb) { #ifdef CONFIG_HAVE_RCU_TABLE_FREE tlb_table_flush(tlb);