From patchwork Tue Feb 15 14:43:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 12747161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39D8DC433EF for ; Tue, 15 Feb 2022 14:43:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EBE426B008A; Tue, 15 Feb 2022 09:43:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DF7F56B008C; Tue, 15 Feb 2022 09:43:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4E146B0092; Tue, 15 Feb 2022 09:43:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id B07576B008A for ; Tue, 15 Feb 2022 09:43:21 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7866C8699D for ; Tue, 15 Feb 2022 14:43:21 +0000 (UTC) X-FDA: 79145282202.22.BC3A83E Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf03.hostedemail.com (Postfix) with ESMTP id ADF822000D for ; Tue, 15 Feb 2022 14:43:20 +0000 (UTC) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FDunie005201; Tue, 15 Feb 2022 14:43:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=Le09Yyqh/Lt4iScmunRFDbexNnWKBhNSzPw6e39z3oM=; b=DnqPI9CWyBBIjI0ZzprVAO+TLmPrB8pop/DyV8/4HQZmtI/j5035hy1Y+hahDKhRZ1Pr /3j8OOIZdwLTrBF8jv8bftCdudbjN7RhzwIu70jWtFVzCb9q1UfkcNEfz9h+1m57eNKZ sy4bVHqSt4qw1k+I8sFXyM5sgGUOxkrR7TdVUyM4whwXqDR2UT8BmYu55fNEXDqYcAc+ 2N0TfWYjEwFdxhICKRLXJfRNfCSUZ52A9BAdbLOMLb16Cj5tAWRmlWZJYVD26zbA62mA n7kJ3lFZ5FIhXB7CRPzgu71FEvicKyw4DN8FJQmWIZU5v9rEEVoReBCvNgX5KH20l9x0 Bw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3e8570shrx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 14:43:19 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21FEeUFm145877; Tue, 15 Feb 2022 14:43:18 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2048.outbound.protection.outlook.com [104.47.56.48]) by aserp3030.oracle.com with ESMTP id 3e62xeqejm-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 14:43:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XvIdFp5hEEZJyl2oI+KX9OMDoIfocRdUYMqKXW1TVpXIcBuwe3TMS0qDIWcbNh0pn/B9Y/mHMUUuD9OJqLGURJMe7Z1Qw6dvfqoefffWuihQoClrCa+zp2+X83yZBPHKXdL1fg8SKnkBi2vLycL1x9PsxizhMwTVvJ4gywIGZVm1RJHTNha0VEZnXQdptzX/eCByXgt9O6oPaus0ZQcNS/DxEt/q3osXV/tO/XDJo1ZkZO+UYDZ2Hik1GnX64aRL3L2Wjp87/IYbDbf+biaazOlHPFKfLC+AUHDbd1tMHlzpzg0jbs/YoQxlXG/zaHoN4YhOUvge3RXupHA6CGDgag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Le09Yyqh/Lt4iScmunRFDbexNnWKBhNSzPw6e39z3oM=; b=PRosTjotnH6/8n2FFxhgecZxk7ochySvbLorNZoUwaTy7qyQfH0Jb+M+2UpbzVuCMNcvJ7+Hw58+i6icOKMQ0+b2Bs9EVADIMMYdG5o/URhQBIzmFwfkNHhD200xLbCdCI7gtduZ0PRT1fFJQqdoSrDI2E1EPYDxNesokL79sGouzszaiSBdq0yzTHmYK16y3NeIlB4YwrnkV221JzTQyLq+Lyh3PhpHdbr0UQgKshEHLRUXRzsYqfavoNbXd1+5fReeyU9h3mI9Un+zQMptl88IV9jS+Ns90v7lYghEJdPF3MKyb8ShZPAwhTDfOBj1J40hET6hK5xP1B1qEQ2t1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Le09Yyqh/Lt4iScmunRFDbexNnWKBhNSzPw6e39z3oM=; b=I5pjBsFrh2L7uIUXVjJl27m9ZAJ7Crk60uLt3h4lRqd4O+cel3BXSSHWDKTCQdg3H3ZwOY+hx7E4HKW0aVB3YtVAySSYN2IhCl72KwNwYUoZi8pWJvm7z2MVPvBynrcjVFOlsriErFqp7GPFCadrDHouc/X2zQHwLvtYK0VK/t0= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by CO1PR10MB4689.namprd10.prod.outlook.com (2603:10b6:303:98::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.14; Tue, 15 Feb 2022 14:43:16 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::899e:951a:8129:8ef1]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::899e:951a:8129:8ef1%4]) with mapi id 15.20.4975.019; Tue, 15 Feb 2022 14:43:16 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: [PATCH v6 22/71] mm: Optimize find_exact_vma() to use vma_lookup() Thread-Topic: [PATCH v6 22/71] mm: Optimize find_exact_vma() to use vma_lookup() Thread-Index: AQHYInpaRgtDkE1/0UmN4fjxAjhoWA== Date: Tue, 15 Feb 2022 14:43:10 +0000 Message-ID: <20220215144241.3812052-22-Liam.Howlett@oracle.com> References: <20220215143728.3810954-1-Liam.Howlett@oracle.com> <20220215144241.3812052-1-Liam.Howlett@oracle.com> In-Reply-To: <20220215144241.3812052-1-Liam.Howlett@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.34.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 716f7f7a-fa03-4a54-0b4f-08d9f0918048 x-ms-traffictypediagnostic: CO1PR10MB4689:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4125; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AlfS3NwjBc5+mfGVzr3tAdtUL3VpG3gL2pXC85MS8guIWyag+APLfgQAB24TWDjIu/kIcgNpuMtqd+77mnfiLb38cLo2MI+UcZ3g4G7RzJ6WAHFcGIwuNk3rmA81kXXvkWQkrPY1u0WnU4897CqnjsBeEWKZFEUFFkHVYvyjlBZ2+0xGFJPEVvz1JCtKTmz4yVEGPPdlYoiaAHA1VsveEb8/IVB+P8OqG8t7Ln3auabST54AMzIoUuFBi7q4WfdgMq3I9KWSdzPNCWTZGifNOVYrd86uUxOSOm4z4LGAeOwvnOfazfJl2v10FX1B3Do6iVMzC7Cta2DQMu4bEIbG/BXFpa8jLz5aFPerJIQuTXyHe4eko2z0ihMF70hmDNptHX63XSMc04W4jtMm4vmgdHA9xDRsZOjpmaZJIEccr5Bt2tqBzlgs1rsFXWR+Jd2L/Yda22GswbIlYekoX4ihFDFSItwkXVJQFxO46RBiW0Ifts2K2ls3hhOU5hs2tMl+HGssSDj4rVsvpTkSoQsUIvI/ebYlw3JXZ7wGevcKnRQ7KAhCYoYBjCiXhRD7zMA5mdOQoUjcTk5Q81u1sInmJPb/CK9NK51iRm5fAiXdJsxYB0JbHjh8ZjzDfxwplyGPJU7/aT0cKSDnbI+gxD1pUrNOrOqnLt81dW4UBXDBaRxqlyAbwaPPlpr3wu0Q5pQC5njXbh4Bo1daEZ1h4tC3ew== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(66946007)(76116006)(66446008)(64756008)(66476007)(66556008)(91956017)(8676002)(6486002)(8936002)(86362001)(316002)(110136005)(38100700002)(122000001)(38070700005)(2616005)(6666004)(6512007)(44832011)(36756003)(4744005)(1076003)(26005)(186003)(2906002)(5660300002)(83380400001)(6506007)(71200400001)(508600001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-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bhkNaaNFchQ+HzcS3XFggemJ?= =?iso-8859-1?q?z0C/uLKzBrvV1cfovSlisiXryWgfFpHU5QOIux80Q6eoYgMf5kNxWkMdbwnq?= =?iso-8859-1?q?dh/I6FD/tOY/75AyNpDXqCyXLWuuuNgFSkQtRJHuA+ZPlErx+hsgC46cTGyy?= =?iso-8859-1?q?Q9vC8xQXI8QsTZiS8Grd0kliznqYXrM1KOp5qiKzOC47fAgPFpHIgXP0AlpE?= =?iso-8859-1?q?NCFBngDxg/Ijlr2PPUmpSPAr4V9Ys+IYVEjCuagyggq9YNFJI0L/0QTXmVVn?= =?iso-8859-1?q?mfLLMWammzLTU94GXOSKni5XibfZbJn9M4Uc3+FsR7/sEWnmEglVWXfoZ12Z?= =?iso-8859-1?q?wqNXYuRf/AXcncBuIv7EZ+1BeBCmy8HdhPKIn6izV9WVowWHUbOvGmx4+2lw?= =?iso-8859-1?q?effULssr4AAwLMUyPJnxzOKB/tH1pZ2BEdu229qOIV+aX026TobqfM9uOJKa?= =?iso-8859-1?q?YR4R5J16VKuojxPXgS5LdMBHiXXx4QTnqmDfRn5NfCuAzpPAZJlnvKvR54E8?= =?iso-8859-1?q?epWFxejYDn9O3wOAq2VZawsZCY6AiGvrSTqqJbkfd1J4Dia2koD/aDuPMCKT?= =?iso-8859-1?q?2Vx1TG25kah91dSkIZ0VBa3V0pbVKqfl9q85nNWdBVJk21TAyVbXNVR60tQp?= =?iso-8859-1?q?CqxPubwI4JqLn42hs6i2qu4bK1Pu+mUPBy9rG/h1TB7lXuTmqvRybxBE3ggC?= =?iso-8859-1?q?E3WGhZCjte2jYDkK1NNCO8dg5SVhvyxcX8e3xJsRWHYxTkYgdBZgNq4NQ6hd?= =?iso-8859-1?q?+CsNxHDuqjTwvEPIcboReY648XFYoZ8fo4sOw67AwfjwAlMvOFuDtn8ommE0?= =?iso-8859-1?q?=3D?= MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 716f7f7a-fa03-4a54-0b4f-08d9f0918048 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Feb 2022 14:43:10.4644 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0ahWd20fvCDLU0Z/Z02/+8GUJMqNTpP6mn+UpBWz9+PvwMD1xf/J+Eh1UhlXKV2u4NErUq3haBsD9FwIpMaqJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4689 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10258 signatures=673431 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 bulkscore=0 malwarescore=0 adultscore=0 spamscore=0 mlxlogscore=713 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202150085 X-Proofpoint-ORIG-GUID: IvCIwHFyY3-xWU6YlgCvNX5BCUEHECnu X-Proofpoint-GUID: IvCIwHFyY3-xWU6YlgCvNX5BCUEHECnu X-Rspamd-Queue-Id: ADF822000D X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=DnqPI9CW; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=I5pjBsFr; spf=none (imf03.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.165.32) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Stat-Signature: fpy8n4bu9a5w3uykwp1zpp8wd5trg78f X-Rspamd-Server: rspam11 X-HE-Tag: 1644936200-786210 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: From: "Liam R. Howlett" Use vma_lookup() to walk the tree to the start value requested. If the vma at the start does not match, then the answer is NULL and there is no need to look at the next vma the way that find_vma() would. Signed-off-by: Liam R. Howlett Reviewed-by: Vlastimil Babka --- include/linux/mm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 4c2341bcaf03..110b1dcfb036 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2856,7 +2856,7 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma) static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm, unsigned long vm_start, unsigned long vm_end) { - struct vm_area_struct *vma = find_vma(mm, vm_start); + struct vm_area_struct *vma = vma_lookup(mm, vm_start); if (vma && (vma->vm_start != vm_start || vma->vm_end != vm_end)) vma = NULL;