Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2173896imu; Thu, 29 Nov 2018 00:12:21 -0800 (PST) X-Google-Smtp-Source: AFSGD/W6h7Ynt5U4hSAGVtI28EOnY7XDSfxbFjTbmZr0E51RmEQiRVy79ETVjOpIYcFvriV9bmNg X-Received: by 2002:a63:fc49:: with SMTP id r9mr393547pgk.209.1543479141534; Thu, 29 Nov 2018 00:12:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543479141; cv=none; d=google.com; s=arc-20160816; b=CwUORj7TzDvgZNNLk8YYGumizHwxxEy4c0iyTrZxYYy2veKqVMSnrNRnl2B+4ykR5D e3mzW5h0n6BefxSDDxhgUskZSUE2eWlUDnw6a7EZJ6PjrSzgG7NJ3vNJ9jqDk2eThAzC zqkMhRBBeg/IcHQikwPArf6iA4fCzyI8p+DPFm6u+og5Yn2JtrMO8/fq+7DhVgogHDUH FSBgAuBRdmvji8ZBojS5HsimC0sbn2S2JIWt7EdqHseKKOI0+uB4PmDxyyvSWb44Lurr NfYwe7dUhB4IdQ2X1/KBill2XzrzaIC/Vy/QUlJCjHFghU2Yh1MEPy2JItlyEJvAYOxq 0w9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id; bh=A7ZWel+91074Y+hEXHxirXsuyI9qyVzJTbyX/XVJ25E=; b=k41S3C4L70lSIv9o7OtpOeiVjXJidTa6MuRfNSedMZURGWmZXsaCLH0kN73BnLIMFx WbYmQly4WUyDOKUPZMgvQcGdVKJMc13YVbFMzXlIV67+BG2tgJIAHd6BcJ4bQWTk+Nif mUV9fG3gI+YW+uVhM2wChv4xezMejx9pMqkPPtVM2zL86Do3mGoglFgg6CzjT7BjVnYM SaLyQ0RKD5jJo8lb4lVAWLabmIS3Brgz4qMT7wU/G41jn8oGeafuwmi+EsCYtBegrCrJ ZZ0rFRiXaCKVMahS7NlSXOSum4KhvGb9/rv1BXIxMt8/udbw0Tz0ITdk09PQ6+dIxkJB pqzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s192si1514446pgc.144.2018.11.29.00.12.06; Thu, 29 Nov 2018 00:12:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727653AbeK2TOo (ORCPT + 99 others); Thu, 29 Nov 2018 14:14:44 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:21374 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727666AbeK2TOo (ORCPT ); Thu, 29 Nov 2018 14:14:44 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4359Dg2xDPz9vGm2; Thu, 29 Nov 2018 09:10:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id cn40Xl71aGkq; Thu, 29 Nov 2018 09:10:11 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4359Dg2Q24z9vGlV; Thu, 29 Nov 2018 09:10:11 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2B0EF8B890; Thu, 29 Nov 2018 09:10:12 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 0QbdZywHSf0P; Thu, 29 Nov 2018 09:10:12 +0100 (CET) Received: from po14163vm.idsi0.si.c-s.fr (unknown [192.168.232.3]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 067F28B762; Thu, 29 Nov 2018 09:10:12 +0100 (CET) Received: by po14163vm.idsi0.si.c-s.fr (Postfix, from userid 0) id CE15C69AEA; Thu, 29 Nov 2018 08:10:11 +0000 (UTC) Message-Id: <6acfdaf9ca44737cfd0dfec8fc9157e5838f7ce9.1543478200.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v8 04/20] powerpc/mm: Avoid useless lock with single page fragments To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 29 Nov 2018 08:10:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no point in taking the page table lock as pte_frag or pmd_frag are always NULL when we have only one fragment. Reviewed-by: Aneesh Kumar K.V Signed-off-by: Christophe Leroy --- arch/powerpc/mm/pgtable-book3s64.c | 3 +++ arch/powerpc/mm/pgtable-frag.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c index 0c0fd173208a..f3c31f5e1026 100644 --- a/arch/powerpc/mm/pgtable-book3s64.c +++ b/arch/powerpc/mm/pgtable-book3s64.c @@ -244,6 +244,9 @@ static pmd_t *get_pmd_from_cache(struct mm_struct *mm) { void *pmd_frag, *ret; + if (PMD_FRAG_NR == 1) + return NULL; + spin_lock(&mm->page_table_lock); ret = mm->context.pmd_frag; if (ret) { diff --git a/arch/powerpc/mm/pgtable-frag.c b/arch/powerpc/mm/pgtable-frag.c index d61e7c2a9a79..7544d0d7177d 100644 --- a/arch/powerpc/mm/pgtable-frag.c +++ b/arch/powerpc/mm/pgtable-frag.c @@ -34,6 +34,9 @@ static pte_t *get_pte_from_cache(struct mm_struct *mm) { void *pte_frag, *ret; + if (PTE_FRAG_NR == 1) + return NULL; + spin_lock(&mm->page_table_lock); ret = mm->context.pte_frag; if (ret) { -- 2.13.3