Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2404664ybj; Mon, 23 Sep 2019 03:16:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCV34vBMSLVPwmjAEWiliqRnWuOt5rIf9TzFk3eToxct+BL4Lmepb4bZnqAFO9jy9E1VBK X-Received: by 2002:a17:906:1394:: with SMTP id f20mr30403892ejc.274.1569233814836; Mon, 23 Sep 2019 03:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569233814; cv=none; d=google.com; s=arc-20160816; b=J2AmJXxeKLXy+PIGw0/OfK9/8uVonqhcdXYxaS2ZlCJHbuim2BU3qF1Q+XBWbhyMNJ hUSPEWIb1oERpkAfr3fmaZRgHdszHOi4OuIHZdQj78HUGAQTvmscyySLG8Kqs92b2Dvj YA41FTq2PdMtFbztUNh4pM4/vulNOg4BbGTs8BJMUuYUL6pwNruUtesfiRdfH3Pk4SGr XXkgzkatE0FPQ8yUDB7C+nZpk93aG1on1T/KPfCRjNrZ3X1Urr0+YKap1qP9QLOMtdXL UlyLnoDm+bOKpPdJtgorJWHd6oqZIjcsfvx4W4xqoKVg/FuHA24k3IBq69uXJ0WiFmro IUZA== 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=tlH2QkbzG1Qnus3kTViVYWBQDdbs0ULuD5ksevdR3vc=; b=mEj9N6WMXIB0WnrYGs+0lZdLv01Hb3Y93asFwA/48btWUrRZ2l4lEs12XFl3rx3u6H m6oovsXOfZThrZKR3MEubzRJiZl/xGamnZJlcgPvfJ7GofpWyISmT4RmVMrIaplKj/cs u29qosp4WbomfjaY2VpZickABy5PdBHUEacvRP44dPo2NP+WQDYZD71lN0hv8f4fntTE eWDQAQNgOlT8q1efUIxJkyd5FRSvPqvLeHnhOnhyTe0nmhfo2n2tw3vuiRLljmfn5VN5 72/5NqIQ3LFfXWC5MCHEDa6OUyXjnxxqdN7v549Qs8elzcT0JrTnN0sOzXIID7FJY6el X6cA== 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 o17si4688581ejm.261.2019.09.23.03.16.28; Mon, 23 Sep 2019 03:16:54 -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 S2436793AbfITTwF (ORCPT + 99 others); Fri, 20 Sep 2019 15:52:05 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60624 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436786AbfITTwF (ORCPT ); Fri, 20 Sep 2019 15:52:05 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8KJluoJ113619; Fri, 20 Sep 2019 15:51:36 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v4sh5q52g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 15:51:36 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x8KJmBI4114156; Fri, 20 Sep 2019 15:51:35 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v4sh5q520-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 15:51:35 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x8KJoGKR001958; Fri, 20 Sep 2019 19:51:34 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma02dal.us.ibm.com with ESMTP id 2v3vbu4u00-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Sep 2019 19:51:34 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8KJpWZE62325092 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Sep 2019 19:51:32 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8251D7805C; Fri, 20 Sep 2019 19:51:32 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF1AF7805E; Fri, 20 Sep 2019 19:51:27 +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:27 +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 03/11] mm/gup: Applies counting method to monitor gup_pgd_range Date: Fri, 20 Sep 2019 16:50:39 -0300 Message-Id: <20190920195047.7703-4-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=765 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 As decribed, gup_pgd_range is a lockless pagetable walk. So, in order to monitor against THP split/collapse with the couting method, it's necessary to bound it with {start,end}_lockless_pgtbl_walk. There are dummy functions, so it is not going to add any overhead on archs that don't use this method. Signed-off-by: Leonardo Bras --- mm/gup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/gup.c b/mm/gup.c index 98f13ab37bac..675e4be27082 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2404,6 +2404,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, unsigned int gup_flags, struct page **pages) { unsigned long addr, len, end; + struct mm_struct *mm; int nr = 0, ret = 0; if (WARN_ON_ONCE(gup_flags & ~(FOLL_WRITE | FOLL_LONGTERM))) @@ -2421,9 +2422,12 @@ int get_user_pages_fast(unsigned long start, int nr_pages, if (IS_ENABLED(CONFIG_HAVE_FAST_GUP) && gup_fast_permitted(start, end)) { + mm = current->mm; + start_lockless_pgtbl_walk(mm); local_irq_disable(); gup_pgd_range(addr, end, gup_flags, pages, &nr); local_irq_enable(); + end_lockless_pgtbl_walk(mm); ret = nr; } -- 2.20.1