From patchwork Wed Feb 2 02:42:06 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: 12732587 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 0163DC433F5 for ; Wed, 2 Feb 2022 03:27:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7B0118D00DF; Tue, 1 Feb 2022 22:27:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 75F058D00DD; Tue, 1 Feb 2022 22:27:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58AF98D00DF; Tue, 1 Feb 2022 22:27:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0101.hostedemail.com [216.40.44.101]) by kanga.kvack.org (Postfix) with ESMTP id 48FC88D00DD for ; Tue, 1 Feb 2022 22:27:13 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 14B7F18211CF6 for ; Wed, 2 Feb 2022 03:27:13 +0000 (UTC) X-FDA: 79096403946.05.C19893E Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf12.hostedemail.com (Postfix) with ESMTP id 8940240003 for ; Wed, 2 Feb 2022 03:27:12 +0000 (UTC) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 211Nsv90022152; Wed, 2 Feb 2022 02:42:13 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=bONis78zhrwarNzckVIxjxaX9AlTOK7kAZIEBwV3K/oYl7hf9fyGBZMfGksXKG6zdQ4/ JsONJEGHvfG/CHnYHsKCMbEokC6tqkQ9fkJD/sLedgAA0ZvfhZAaqO/D9RcNO9pnl0f2 5dp+wV7WS6CtsgiJRjuibt5peYLMogIw4tbbxCNpS9BvmXvChLvpxE5O9QQq+aLYZ4aD w8bHFkktCf+RzhhmFPDAfKwEmwnLo8t3aL3zkcqOVptok/e87/nrfdJBcZzngmVHq6tF Ht9dIFsBfIEqKSkwbCJ53tF8j9NJFFJKY/bJxfzVILKL2NC2ONkAA5XhWBlC6ZGVrtgZ 6A== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3dxnk2m7px-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Feb 2022 02:42:13 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 2122ZdSG126532; Wed, 2 Feb 2022 02:42:12 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by userp3030.oracle.com with ESMTP id 3dvtq1m94n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Feb 2022 02:42:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OZpWR3GYifWuU6xbapWtYxlyVnCI+z2d1X2/TTGoC4MSEXyPVZkPu2hXhoAHO8WVuegDx8RvOBAYI+iVdLl2AiDjYxiNVW1//HIdDhPmMFzl690WTJyOxohu5kobyIQUyccFafsNsA+GxiVMMe9tUjUbJj61OsaiZ19pDQwamv9G/UpnWgDG5SEoylblgOmMSLNul+OmQ36zoYhon4dS+HzOg/yLbXpwfpZ7Kvg+NdGI2oqfE+DlFWuFi1POiQEciE2w8+nD9fIVQo/DzVXSkGjvQwdgl5nJJrvuYsR4n6QvDAXlG1j6PTgqgcU3vjwbiA6WK7mPAoPfRsaQIEcDFA== 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=DxxTF9yXuCOrW1x9FGRH7kllpzTz+SS7Rhvs/+hFM7G900cW6sxNQrKwxzhYMvfkAOpkrBRbOFnWlMcKf4Sg3NJxH15ASRcN8BCMaRQckOmISHa+hOtGUB+mZnN0Jg/XPyiQ0AvQ4OscVrzd/l4H+QZTBSf0gRrvlilxARWYKNUPNlUFQlp/FC/8jFa23ZyLKlvAPzcbLTyBdv8ITTSkkOkOgP/Hxe/nRKJ9GcHiwSom2SjVl0cyriUmdMz2sVAVDadKaP6d/EiHf6TWWJcRxoU6KOgR/rx+Oqq2h9blTnLiDxbXgt/29yV5JTiPvkpfPx93FTrh7oRKJxM3ZX4/Vg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=DlTGE46A3d2C3MpUDFZMDIrM6JK7jv25d6Fg6bR+Ghqx/uDqn4vt7LLuLQSdS2+dViURqCh3shbJiMCY0qq9LMDNtfVKfPUwOltZGyUqGDFLqRagtqZBJEfqmCo11t/2CsGKJdG9WOxkF4v+cCDnIPW45ko7261QC/esAAu9a0o= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BY5PR10MB4129.namprd10.prod.outlook.com (2603:10b6:a03:210::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.11; Wed, 2 Feb 2022 02:42:09 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::3857:3a25:3444:fdd3]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::3857:3a25:3444:fdd3%5]) with mapi id 15.20.4930.022; Wed, 2 Feb 2022 02:42:09 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: [PATCH v5 21/70] mm: Optimize find_exact_vma() to use vma_lookup() Thread-Topic: [PATCH v5 21/70] mm: Optimize find_exact_vma() to use vma_lookup() Thread-Index: AQHYF953+R+DFIvcQ0GNJnO/FQJEWg== Date: Wed, 2 Feb 2022 02:42:06 +0000 Message-ID: <20220202024137.2516438-22-Liam.Howlett@oracle.com> References: <20220202024137.2516438-1-Liam.Howlett@oracle.com> In-Reply-To: <20220202024137.2516438-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: a1fb72d3-0a76-4af8-e9f8-08d9e5f59bf0 x-ms-traffictypediagnostic: BY5PR10MB4129: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: UROeTd7wMRFsdIytuCK55K2G1kUcDdQ1ltTRAiNJ7nFbea+HHb0jZEXUl4Tk8RxqF/9+K0mfs8NJCDPLQhoYsGVfqq2GMOVjruD1zgqDIwRs/BfWllaDatbonlo2/VCoHmd0cKLovcYKUfFkLrEgVpyfAO6kRJJpgmzZi+4wHajGLwf9ApWENdt7OQJ40DUPdTpvcZLIJwkp9bAU39iVx6RLDV9YwFeklOeoDPj7hZ7ac/2vUCb3hrNhfin13yurQRoUTHLRVVjfbLGKZ/uGEtciEAAlxAWxphVeON/5RiiJMN621eecXPwpEzRy0JLOWlNW6wIa8tkKP57sXab3fftwwT/U3IzsEKG1hIr/s8uSv+1GuPlqV4j8TdR1/qPkK4UvyM9NvmUID5WlH1pbbbQkkYXJxVS8LVbsu9vWA+Ja9BOFJ92BS5e2N0ZxBUBkerFZ+gMSedFVMmg4spJYWgD0dtERg+h0e1mWMK3yeyb0gThgXvyvpsLfDBA5GWUNykXLS6YfUvyUURd2wplmCGMxOu174taOkoW0SZeZnwyFJ5ycZvAo5MTMyEERKTUsB6liw8IOnZVDvc+2Ptp1sOYfE5JBSneeEptd2JjT/4uxIzQycfjqNnu3DezBsoTV6RVBdLRoI2RQMIDrhPfh9R2bUejbQh0kCbAe/fM1EhYPbXsHMuQFoT9LqHPtVa/oMvq0Aby9XoldoEhSdK6ZTw== 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)(38070700005)(6486002)(83380400001)(36756003)(1076003)(26005)(186003)(122000001)(38100700002)(110136005)(316002)(91956017)(44832011)(4744005)(5660300002)(2906002)(8676002)(8936002)(2616005)(66946007)(76116006)(64756008)(66446008)(66476007)(66556008)(6666004)(508600001)(6512007)(71200400001)(6506007)(86362001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?gXvbAUq2ztNgOEEFobE5eHd?= =?iso-8859-1?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IiRqQLPFixBRrauaDYRrANAB7+fZtMsy3gHSt6wuDqY3?= =?iso-8859-1?q?dsP5JJMpuqAZzo+ghqJy9XUG0VcoRH5qN0EcvjMNGzJfjTctLhNVeD435a7j?= =?iso-8859-1?q?RkzvzBbi6PqY/R+FVOQVHb16BnqUPlJIfxTlE9bX9zZslhz9wCUEB2517d4Q?= =?iso-8859-1?q?OjfqWy/EnRG0FRIgke7aLwdzqOgxnCxC4NndI8PzWLf06pOH1yXMxWQ6bIPX?= =?iso-8859-1?q?JYVK4t1t/kFYoX6sMln2NNStSYgAz4t7t3oIkXBK/mRoxiLWMeD3OClfIl9Q?= =?iso-8859-1?q?gslktXJpfyb29cu9hAVycTEFl6fZtnYkmbBsQTpIBam5RcY4WlA6hPUU4Lsu?= =?iso-8859-1?q?OY4rqiwXxnYOV07Qa7abxVd/Vb+vW/FyjLtvJeGp3GRPuuz6RYKmIXvZTd/8?= =?iso-8859-1?q?4H+hBUS4fyyZykxDBm7Inhzdq6m7bK3pHvG8vyqvFUdMKBGyzVlK2vh20DPa?= =?iso-8859-1?q?kPH8dYUDLxM8EL9OI8mxGkC+o+n/e1wr+ZUy/2SoKhbMBRteqsIfWHIgF/vf?= =?iso-8859-1?q?ZygnJrB0Q1yueKzQWg5TKUPxOnJX9dogKVudEuf0Q0YGqC7trzi7GDa4P8YU?= =?iso-8859-1?q?VdnDCQHaSfmUv2pWxtvbycNdGYAgAiQrp3r4roZhBeHfY73m5vrEar0BYuL4?= =?iso-8859-1?q?m9JZzVhkY6Vpoahy/zy2nn4CMMepSM3DNau8mikiaVLJVmiAfJ+lC0OmIPZO?= =?iso-8859-1?q?reR7++E4j5hTjptmqYSxoF3pTRBRGHxjSG1iHSwQLqf6Ht1NUTytcrYUnDOo?= =?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: a1fb72d3-0a76-4af8-e9f8-08d9e5f59bf0 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Feb 2022 02:42:06.4549 (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: PhNN2ltptIesTplEi8vYvZ8R/k6fosE1wOdlkjWjUShMMAVayRLhyknwks57C05YQbmH8glrKfwfUaupeV90Eg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4129 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10245 signatures=673430 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=731 adultscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202020010 X-Proofpoint-GUID: AI2Kp-1ewNxoVQvcqvzOJ5YDLgoIqPmQ X-Proofpoint-ORIG-GUID: AI2Kp-1ewNxoVQvcqvzOJ5YDLgoIqPmQ X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8940240003 X-Rspam-User: nil Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=bONis78z; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=DlTGE46A; dmarc=pass (policy=none) header.from=oracle.com; spf=none (imf12.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.165.32) smtp.mailfrom=liam.howlett@oracle.com X-Stat-Signature: g7tsf95ygdikck6c3jxm7u9kpyjg5c1t X-HE-Tag: 1643772432-395631 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;