Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2404679ybj; Mon, 23 Sep 2019 03:16:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDu2HiZigdTPg3P4jeQIHQtQKffF4lKbCBu6SYJpIOJIGIrRZAFkEvg4h+/YG0KBq/JsRh X-Received: by 2002:aa7:df8e:: with SMTP id b14mr33447458edy.65.1569233815869; Mon, 23 Sep 2019 03:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569233815; cv=none; d=google.com; s=arc-20160816; b=QK+pW8P3gSZHb6dSf9Gs+UEBxC9KnMV7+1ovfw5y8Fw2jlZoFEP47+DB58alGyof2i JWFhCWaT+A7nNluRGA2DD1a9oHgbZJoaQFltrotoAnji1z20pW4ftyUTw9/XV6Pph1Zs TKOxzL3EX3VXwMmS7kmR/YGwTcTM0ezhZAPaCmgvDdeSKXErX0JsqW517BXU1igkobTB cHEera9WLroDqZTswDYIYGRRS3ctelPgoZJgYP9aN9BpdAni4AIswXS0gM5Cl1kuy+ha YHapxCBgZmdScnetsP/a4iR7HVb5UhOtR5rJKqtzrZCsuUGhlhYz2QuE1yHtg1nTroVi arkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Aj6cHhl6SDQIQGX0C+REhn0r9una7tTfq9UQdauHDEA=; b=nC9QeZ+HNGp1Sa/mV8TZ4sv/dFfjGJLbG3Yzj5Op45hSVQiTNkfIPFC84r7bkdVIgX 0eJlxOczgdQj6UPcICXaY2A9fyHG+AL9/m+tY35GLugYbj8VR7PU8bgq96Vy1vJUOTIE yRcanhHxmxfODcmHqROAVGrgxHz6yNd68I/2b2zWPLi5/dlV5rcSsVYRvOosby1hoNhU 7Y3Ozlb14gfKdlJXMlmPKUt5xVha/zm0ucYEaThU7hKnot/8cGP8cCGX5A2hNELingoY /FiP8Ktl94zh/OC9lvdoRI5IKkvE7jI1COvtV8qBn/Htg5tQWkNMmTLeUShY/JNqwme6 I3Yg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si4962942ejp.350.2019.09.23.03.16.32; Mon, 23 Sep 2019 03:16:55 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729805AbfITTwR (ORCPT + 99 others); Fri, 20 Sep 2019 15:52:17 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:17544 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726089AbfITTwQ (ORCPT ); Fri, 20 Sep 2019 15:52:16 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8KJnsAK129060; Fri, 20 Sep 2019 15:51:30 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 2v549p29uq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 15:51:30 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x8KJo66C130302; Fri, 20 Sep 2019 15:51:30 -0400 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0b-001b2d01.pphosted.com with ESMTP id 2v549p29uf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 15:51:30 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x8KJoIxa004548; Fri, 20 Sep 2019 19:51:29 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma02wdc.us.ibm.com with ESMTP id 2v3vbu8p4p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 19:51:29 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8KJpRHZ50332112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Sep 2019 19:51:27 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 608D77805F; Fri, 20 Sep 2019 19:51:27 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C3FC778064; Fri, 20 Sep 2019 19:51:19 +0000 (GMT) Received: from LeoBras.aus.stglabs.ibm.com (unknown [9.18.235.184]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 20 Sep 2019 19:51:19 +0000 (GMT) From: Leonardo Bras To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.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 , Thomas Gleixner , Richard Fontana , Ganesh Goudar , Allison Randal , Greg Kroah-Hartman , Mike Rapoport , YueHaibing , Ira Weiny , Jason Gunthorpe , John Hubbard , Keith Busch Subject: [PATCH v2 02/11] asm-generic/pgtable: Adds dummy functions to monitor lockless pgtable walks Date: Fri, 20 Sep 2019 16:50:38 -0300 Message-Id: <20190920195047.7703-3-leonardo@linux.ibm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190920195047.7703-1-leonardo@linux.ibm.com> References: <20190920195047.7703-1-leonardo@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-09-20_07:,, 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=998 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909200161 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 + /* * On some architectures it depends on the mm if the p4d/pud or pmd * layer of the page table hierarchy is folded or not. -- 2.20.1