From patchwork Thu Dec 10 17:03:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 11965657 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=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT 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 ABF09C1B0E3 for ; Thu, 10 Dec 2020 17:05:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 438E0230FC for ; Thu, 10 Dec 2020 17:05:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 438E0230FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=Oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E753C6B0072; Thu, 10 Dec 2020 12:04:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E4B396B0073; Thu, 10 Dec 2020 12:04:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D13A16B0074; Thu, 10 Dec 2020 12:04:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id BA4606B0072 for ; Thu, 10 Dec 2020 12:04:58 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 605E83635 for ; Thu, 10 Dec 2020 17:04:58 +0000 (UTC) X-FDA: 77577997476.10.cloud30_100426d273f9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 323E816A0AB for ; Thu, 10 Dec 2020 17:04:58 +0000 (UTC) X-HE-Tag: cloud30_100426d273f9 X-Filterd-Recvd-Size: 5538 Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Dec 2020 17:04:57 +0000 (UTC) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BAGna0h139791; Thu, 10 Dec 2020 17:04:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=/347E1vujMDUPzB7sQHqI8ty+olG6ISzvqpCNopxQXY=; b=Tykuo2aZI4voYgssiwQ5PMXQd9r5PULM+odtjfo2xlA2JXcawSaRUL5SMzxUCqvu+JIT 2vm8EAkpb8ArRChbKuEa3g+QO7ARuLxbMZSJ7IQ6C1y2/REFj/RFrgSUCTAGh4txt86H 03pHo5jRkDtfINVT+0xKeg8N6oDUk2POAeZJxSOD0oUWPyz2Wc+BmdloM4TT//2LlzAU x5arPRVZA7DDtbcVrRlAUOByLgZjCYvYcGsXd5cA2LxveDU/FyhRi5FiTweel7h0/3Ly vhP3Wm3bvKv1ZVEgPxd4YATNDh2FtNwI15JlYnP5d+wsRhLGPm+QzpgKS/gY/iJZerPV EQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 357yqc6m06-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 10 Dec 2020 17:04:50 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0BAGvKXE162576; Thu, 10 Dec 2020 17:04:49 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 358ksrr5d7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 10 Dec 2020 17:04:49 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0BAH4nsM009036; Thu, 10 Dec 2020 17:04:49 GMT Received: from revolver.jebus.ca (/23.233.25.87) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 10 Dec 2020 09:04:48 -0800 From: "Liam R. Howlett" To: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , Song Liu , Davidlohr Bueso , "Paul E . McKenney" , Matthew Wilcox , Jerome Glisse , David Rientjes , Axel Rasmussen , Suren Baghdasaryan , Vlastimil Babka Subject: [PATCH 13/28] mm/gup: Expose mm_populate_vma() for use when the vma is known Date: Thu, 10 Dec 2020 12:03:47 -0500 Message-Id: <20201210170402.3468568-14-Liam.Howlett@Oracle.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201210170402.3468568-1-Liam.Howlett@Oracle.com> References: <20201210170402.3468568-1-Liam.Howlett@Oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9830 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=872 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012100106 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9830 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=887 clxscore=1015 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 spamscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012100106 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: When a vma is known, avoid calling mm_populate to search for the vma to populate. Signed-off-by: Liam R. Howlett Reported-by: kernel test robot --- include/linux/mm.h | 4 ++++ mm/gup.c | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 1bfa2ee41187d..6cc8825f26414 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2587,8 +2587,12 @@ static inline void mm_populate(unsigned long addr, unsigned long len) /* Ignore errors */ (void) __mm_populate(addr, len, 1); } +extern void mm_populate_vma(struct vm_area_struct *vma, unsigned long start, + unsigned long end); #else static inline void mm_populate(unsigned long addr, unsigned long len) {} +void mm_populate_vma(struct vm_area_struct *vma, unsigned long start, + unsigned long end) {} #endif /* These take the mm semaphore themselves */ diff --git a/mm/gup.c b/mm/gup.c index 102877ed77a4b..522f8fd491ead 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1431,6 +1431,26 @@ long populate_vma_page_range(struct vm_area_struct *vma, NULL, NULL, locked); } +/* + * mm_populate_vma() - Populate a single range in a single vma. + * @vma: The vma to populate. + * @start: The start address to populate + * @end: The end address to stop populating + * + * Note: Ignores errors. + */ +void mm_populate_vma(struct vm_area_struct *vma, unsigned long start, + unsigned long end) +{ + struct mm_struct *mm = current->mm; + int locked = 1; + + mmap_read_lock(mm); + populate_vma_page_range(vma, start, end, &locked); + if (locked) + mmap_read_unlock(mm); +} + /* * __mm_populate - populate and/or mlock pages within a range of address space. *