From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96C41C77B62 for ; Mon, 23 Sep 2019 20:39:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5408420673 for ; Mon, 23 Sep 2019 20:39:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="C7EsM4V7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5408420673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4749D6B0291; Mon, 23 Sep 2019 16:39:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 426276B029E; Mon, 23 Sep 2019 16:39:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 314016B02A4; Mon, 23 Sep 2019 16:39:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 0951E6B0291 for ; Mon, 23 Sep 2019 16:39:31 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 8D720180AD804 for ; Mon, 23 Sep 2019 20:39:30 +0000 (UTC) X-FDA: 75967350900.28.skin46_18b944fcc3419 X-HE-Tag: skin46_18b944fcc3419 X-Filterd-Recvd-Size: 5622 Received: from hqemgate15.nvidia.com (hqemgate15.nvidia.com [216.228.121.64]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Sep 2019 20:39:29 +0000 (UTC) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 23 Sep 2019 13:39:35 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 23 Sep 2019 13:39:28 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 23 Sep 2019 13:39:28 -0700 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 23 Sep 2019 20:39:28 +0000 Received: from [10.110.48.28] (10.124.1.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 23 Sep 2019 20:39:27 +0000 Subject: Re: [PATCH v2 02/11] asm-generic/pgtable: Adds dummy functions to monitor lockless pgtable walks To: Leonardo Bras , , CC: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Arnd Bergmann , Aneesh Kumar K.V , "Christophe Leroy" , Andrew Morton , Dan Williams , Nicholas Piggin , Mahesh Salgaonkar , Thomas Gleixner , Richard Fontana , Ganesh Goudar , Allison Randal , "Greg Kroah-Hartman" , Mike Rapoport , YueHaibing , Ira Weiny , Jason Gunthorpe , Keith Busch , Linux-MM References: <20190920195047.7703-1-leonardo@linux.ibm.com> <20190920195047.7703-3-leonardo@linux.ibm.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: Date: Mon, 23 Sep 2019 13:39:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190920195047.7703-3-leonardo@linux.ibm.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1569271175; bh=Pnu3kUZV3qnISw7hfrecREvkI45tr1IL6gigaYXJdN4=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=C7EsM4V7A5bMzR1+axYe1tYH7s4JTQUSBGE2/8ldsuzTZ+4p/yBgUycF9NULvu+zs usyEu8Cv3mGjoSeV1Cpr9xYG29lHU55L2yoMJZGQRaSpmrd3Oq63YcMXiU1VFm7SWo Ah32v/KzRTmMyNdt59SMGwr/bZeuDmYV6Xa37ZAy9dJkb+TPRsCK4uRqND//sHvb9i TA7OFxydEUsnPdxGoOdPtVslJmrJYrKs8rWwd+0LOnH0i1febGq6ZNOrc64fYQvi8J xUzAkYgnb/7HR3dQVPqxHUKONC4uX83GTW6KfweEkOmpiARuLlkj4ip0LPYCvAZk43 Sm6LYexcDtGAw== 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: On 9/20/19 12:50 PM, Leonardo Bras wrote: > There is a need to monitor lockless pagetable walks, in order to avoid > doing THP splitting/collapsing during them. > > Some methods rely on local_irq_{save,restore}, but that can be slow on > cases with a lot of cpus are used for the process. > > In order to speedup these cases, I propose a refcount-based approach, that > counts the number of lockless pagetable walks happening on the process. > > Given that there are lockless pagetable walks on generic code, it's > necessary to create dummy functions for archs that won't use the approach. > > Signed-off-by: Leonardo Bras > --- > include/asm-generic/pgtable.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h > index 75d9d68a6de7..6eb4fabb5595 100644 > --- a/include/asm-generic/pgtable.h > +++ b/include/asm-generic/pgtable.h > @@ -1172,6 +1172,15 @@ static inline bool arch_has_pfn_modify_check(void) > #endif > #endif > > +#ifndef __HAVE_ARCH_LOCKLESS_PGTBL_WALK_COUNTER > +static inline void start_lockless_pgtbl_walk(struct mm_struct *mm) { } > +static inline void end_lockless_pgtbl_walk(struct mm_struct *mm) { } > +static inline int running_lockless_pgtbl_walk(struct mm_struct *mm) > +{ > + return 0; > +} > +#endif > + Please remember to include linux-mm if there is a v2. Nit: seems like it would be nicer to just put it all in one place, and use positive logic, and also I think people normally don't compress the empty functions quite that much. So like this: #ifdef __HAVE_ARCH_LOCKLESS_PGTBL_WALK_COUNTER void start_lockless_pgtbl_walk(struct mm_struct *mm); void end_lockless_pgtbl_walk(struct mm_struct *mm); int running_lockless_pgtbl_walk(struct mm_struct *mm); #else static inline void start_lockless_pgtbl_walk(struct mm_struct *mm) { } static inline void end_lockless_pgtbl_walk(struct mm_struct *mm) { } static inline int running_lockless_pgtbl_walk(struct mm_struct *mm) { return 0; } #endif thanks, -- John Hubbard NVIDIA From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 454F5C87FEB for ; Mon, 23 Sep 2019 20:42:46 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C53120673 for ; Mon, 23 Sep 2019 20:42:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="C7EsM4V7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C53120673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46cbqQ6wc8zDqH1 for ; Tue, 24 Sep 2019 06:42:42 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nvidia.com (client-ip=216.228.121.64; helo=hqemgate15.nvidia.com; envelope-from=jhubbard@nvidia.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=nvidia.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=nvidia.com header.i=@nvidia.com header.b="C7EsM4V7"; dkim-atps=neutral Received: from hqemgate15.nvidia.com (hqemgate15.nvidia.com [216.228.121.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46cblm6lkyzDqDP for ; Tue, 24 Sep 2019 06:39:32 +1000 (AEST) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 23 Sep 2019 13:39:35 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 23 Sep 2019 13:39:28 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 23 Sep 2019 13:39:28 -0700 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 23 Sep 2019 20:39:28 +0000 Received: from [10.110.48.28] (10.124.1.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 23 Sep 2019 20:39:27 +0000 Subject: Re: [PATCH v2 02/11] asm-generic/pgtable: Adds dummy functions to monitor lockless pgtable walks To: Leonardo Bras , , References: <20190920195047.7703-1-leonardo@linux.ibm.com> <20190920195047.7703-3-leonardo@linux.ibm.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: Date: Mon, 23 Sep 2019 13:39:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190920195047.7703-3-leonardo@linux.ibm.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1569271175; bh=Pnu3kUZV3qnISw7hfrecREvkI45tr1IL6gigaYXJdN4=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=C7EsM4V7A5bMzR1+axYe1tYH7s4JTQUSBGE2/8ldsuzTZ+4p/yBgUycF9NULvu+zs usyEu8Cv3mGjoSeV1Cpr9xYG29lHU55L2yoMJZGQRaSpmrd3Oq63YcMXiU1VFm7SWo Ah32v/KzRTmMyNdt59SMGwr/bZeuDmYV6Xa37ZAy9dJkb+TPRsCK4uRqND//sHvb9i TA7OFxydEUsnPdxGoOdPtVslJmrJYrKs8rWwd+0LOnH0i1febGq6ZNOrc64fYQvi8J xUzAkYgnb/7HR3dQVPqxHUKONC4uX83GTW6KfweEkOmpiARuLlkj4ip0LPYCvAZk43 Sm6LYexcDtGAw== X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Gunthorpe , Thomas Gleixner , Arnd Bergmann , Greg Kroah-Hartman , YueHaibing , Keith Busch , Nicholas Piggin , Mike Rapoport , Mahesh Salgaonkar , Richard Fontana , Linux-MM , Paul Mackerras , "Aneesh Kumar K.V" , Ganesh Goudar , Andrew Morton , Ira Weiny , Dan Williams , Allison Randal Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 9/20/19 12:50 PM, Leonardo Bras wrote: > There is a need to monitor lockless pagetable walks, in order to avoid > doing THP splitting/collapsing during them. > > Some methods rely on local_irq_{save,restore}, but that can be slow on > cases with a lot of cpus are used for the process. > > In order to speedup these cases, I propose a refcount-based approach, that > counts the number of lockless pagetable walks happening on the process. > > Given that there are lockless pagetable walks on generic code, it's > necessary to create dummy functions for archs that won't use the approach. > > Signed-off-by: Leonardo Bras > --- > include/asm-generic/pgtable.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h > index 75d9d68a6de7..6eb4fabb5595 100644 > --- a/include/asm-generic/pgtable.h > +++ b/include/asm-generic/pgtable.h > @@ -1172,6 +1172,15 @@ static inline bool arch_has_pfn_modify_check(void) > #endif > #endif > > +#ifndef __HAVE_ARCH_LOCKLESS_PGTBL_WALK_COUNTER > +static inline void start_lockless_pgtbl_walk(struct mm_struct *mm) { } > +static inline void end_lockless_pgtbl_walk(struct mm_struct *mm) { } > +static inline int running_lockless_pgtbl_walk(struct mm_struct *mm) > +{ > + return 0; > +} > +#endif > + Please remember to include linux-mm if there is a v2. Nit: seems like it would be nicer to just put it all in one place, and use positive logic, and also I think people normally don't compress the empty functions quite that much. So like this: #ifdef __HAVE_ARCH_LOCKLESS_PGTBL_WALK_COUNTER void start_lockless_pgtbl_walk(struct mm_struct *mm); void end_lockless_pgtbl_walk(struct mm_struct *mm); int running_lockless_pgtbl_walk(struct mm_struct *mm); #else static inline void start_lockless_pgtbl_walk(struct mm_struct *mm) { } static inline void end_lockless_pgtbl_walk(struct mm_struct *mm) { } static inline int running_lockless_pgtbl_walk(struct mm_struct *mm) { return 0; } #endif thanks, -- John Hubbard NVIDIA