From patchwork Tue Sep 24 21:24:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonardo Bras X-Patchwork-Id: 11159643 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 960CC14E5 for ; Tue, 24 Sep 2019 21:25:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 61520214DA for ; Tue, 24 Sep 2019 21:25:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61520214DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4AECC6B0010; Tue, 24 Sep 2019 17:25:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 489306B0266; Tue, 24 Sep 2019 17:25:22 -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 3276F6B0269; Tue, 24 Sep 2019 17:25:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id 0E2A06B0010 for ; Tue, 24 Sep 2019 17:25:22 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id A15748243772 for ; Tue, 24 Sep 2019 21:25:21 +0000 (UTC) X-FDA: 75971095242.09.trick75_2ebb14ced7749 X-Spam-Summary: 2,0,0,49924c36220f892b,d41d8cd98f00b204,leonardo@linux.ibm.com,:linuxppc-dev@lists.ozlabs.org:linux-kernel@vger.kernel.org:kvm-ppc@vger.kernel.org:linux-arch@vger.kernel.org::leonardo@linux.ibm.com:benh@kernel.crashing.org:paulus@samba.org:mpe@ellerman.id.au:arnd@arndb.de:aneesh.kumar@linux.ibm.com:christophe.leroy@c-s.fr:akpm@linux-foundation.org:dan.j.williams@intel.com:npiggin@gmail.com:mahesh@linux.vnet.ibm.com:gregkh@linuxfoundation.org:tglx@linutronix.de:ganeshgr@linux.ibm.com:allison@lohutok.net:rppt@linux.ibm.com:yuehaibing@huawei.com:ira.weiny@intel.com:jgg@ziepe.ca:jhubbard@nvidia.com:keith.busch@intel.com,RULES_HIT:41:355:379:541:800:960:973:981:988:989:1260:1261:1311:1314:1345:1359:1437:1515:1535:1541:1711:1730:1747:1777:1792:1978:1981:2194:2198:2199:2200:2393:2559:2562:2731:3138:3139:3140:3141:3142:3352:3865:3866:3867:3870:3871:3872:3874:4250:4321:5007:6119:6261:6742:6743:7903:8634:10004:11026:11473:11658:11914:12043:12048:12296:12297:12438:12555: 12895:13 X-HE-Tag: trick75_2ebb14ced7749 X-Filterd-Recvd-Size: 5773 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Sep 2019 21:25:20 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8OLMOGx115972; Tue, 24 Sep 2019 17:24:59 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 2v7s8pku8m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Sep 2019 17:24:59 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x8OLOwBd121383; Tue, 24 Sep 2019 17:24:58 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com with ESMTP id 2v7s8pku7a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Sep 2019 17:24:58 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x8OLJruo032757; Tue, 24 Sep 2019 21:24:56 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma03dal.us.ibm.com with ESMTP id 2v5bg780sv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Sep 2019 21:24:56 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8OLOsT648169450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Sep 2019 21:24:54 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A5E3AC6057; Tue, 24 Sep 2019 21:24:54 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B6B9C6055; Tue, 24 Sep 2019 21:24:49 +0000 (GMT) Received: from LeoBras.aus.stglabs.ibm.com (unknown [9.18.235.184]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 24 Sep 2019 21:24:49 +0000 (GMT) From: Leonardo Bras To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Leonardo Bras , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Arnd Bergmann , "Aneesh Kumar K.V" , Christophe Leroy , Andrew Morton , Dan Williams , Nicholas Piggin , Mahesh Salgaonkar , Greg Kroah-Hartman , Thomas Gleixner , Ganesh Goudar , Allison Randal , Mike Rapoport , YueHaibing , Ira Weiny , Jason Gunthorpe , John Hubbard , Keith Busch Subject: [PATCH v3 02/11] asm-generic/pgtable: Adds dummy functions to monitor lockless pgtable walks Date: Tue, 24 Sep 2019 18:24:19 -0300 Message-Id: <20190924212427.7734-3-leonardo@linux.ibm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190924212427.7734-1-leonardo@linux.ibm.com> References: <20190924212427.7734-1-leonardo@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-09-24_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=992 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909240173 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: 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 75d9d68a6de7..0831475e72d3 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -1172,6 +1172,21 @@ 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 + /* * On some architectures it depends on the mm if the p4d/pud or pmd * layer of the page table hierarchy is folded or not.