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: 12747160 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 06CDFC43217 for ; Tue, 15 Feb 2022 14:43:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71ECE6B0089; Tue, 15 Feb 2022 09:43:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6CC846B008A; Tue, 15 Feb 2022 09:43:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 483306B008C; Tue, 15 Feb 2022 09:43:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 322D76B0089 for ; Tue, 15 Feb 2022 09:43:20 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id EB4A68699D for ; Tue, 15 Feb 2022 14:43:19 +0000 (UTC) X-FDA: 79145282118.14.1D72D8E Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf30.hostedemail.com (Postfix) with ESMTP id 6B46180002 for ; Tue, 15 Feb 2022 14:43:19 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FDCkJW007116; Tue, 15 Feb 2022 14:43:18 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=HqEzxfb7vYcsBLxA1MHbi67kU0vkdosDz4gDWGEYaOQ=; b=ZCTMSAjrBKWl1UtnOIQ7qzsRqKvz/m4hIIgUPIY6FPHaMJfOZiPpNdHmuTq5Fn2F9KU3 A1aeZDExO/pCl7k18gg9zNdBEfd20K8Rv2rFOlRYVjk2/h+nCt0dsFsjopBhBUvzw6F6 iQGnN1s3MCCg7JLmWNj9Rh/vPdTXSFONEkjY9JolGQCcfUzKw99FiB8+1IpARN7aefda sTMCiCUbIPK9eERvlctOmkXoRoKIl7g1OVrhmUqfqMF/Dy/cJTSWJr21uP25w7KPiCwl W6yZGHg/blfx4s9+aH5v0zg5/cbmaIljoKO+yMuHbp6mmIkikMo+bOeROXA80Vz4PX0n iQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3e884r97em-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 14:43:18 +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 21FEeUFl145877; Tue, 15 Feb 2022 14:43:17 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-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 14:43:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z7aZIwUilPjijGLia4VD04Ui2JRXfe6/AcWkjwsffW1swqp/dDe8UqYtiKRWokKEvwoh5XVoPfSfju2qQGudn6rjOBFBBlAy4qPKK1VNvLpY1HPK5z4Zzfhi+zn216bua0cEBdhryP+nrrL4plMc7BAm4m0iS/x+L8847SFVJZC0rgin470bQyX59bkEWtgEjQBEZIyIGBBJQ/vWOhZ9irEgszi/snmzSAlMBRtS9dUA8441CcHRaD6+/eZldtO6yYPzB/CXKq5KdEWYBSctNMFORJgaJKeeHDC1f9KBSc8kkTmEmQcrabpWmj4dvB0yxbN01tasyoCapx7r1vVrMQ== 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=HqEzxfb7vYcsBLxA1MHbi67kU0vkdosDz4gDWGEYaOQ=; b=DHmiVzdLjyDAHyMgKUtOewd9drnEVXKfoC6hrqvnBE1RTySuUWgXWKl8DuUcTYn6husGks8WP0pFcdnu/vyBEnQvN/tsA6cpuGgLqutCME5QbQtTARXcxfJax3vFpLZy/iyUiChD3KUOKQ/dVxS28IWzr75oB0Yrq8cz0cTTMVUkx8gwkT7JcSYXadCoBdqnECYmcKBb16xNwuER3ghhPpMjY9kXYsPW1vOJuujGsoSMKsQinEkh0SycNyfprKsrYWjfgC9dLapVWJLuKgs3kSKuOno+GGzhcsd9qOObVsqHlWl7VGthX/oCdsRdR/OpDEEM6Ryw4u65hwdcjwp9kQ== 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=HqEzxfb7vYcsBLxA1MHbi67kU0vkdosDz4gDWGEYaOQ=; b=P1X4ST4PaCMxPZaEo+I8Wm+ctLQx5wksNUvi0je0fp+SHJFxjufo2kJzk429wJGcNbAAsuMm+alkl+lkmRZs+0wjV4I15oKdh2+heArwDw2EDKusPn5H4hSoK2Zbvx7HlWJvFbijfj3nvM22B00V93oCwWriMv5kDD7rlWTNffc= 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:15 +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:15 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: [PATCH v6 21/71] xen: Use vma_lookup() in privcmd_ioctl_mmap() Thread-Topic: [PATCH v6 21/71] xen: Use vma_lookup() in privcmd_ioctl_mmap() Thread-Index: AQHYInpanv/7ctYBJE2cR7E6rRpfuQ== Date: Tue, 15 Feb 2022 14:43:10 +0000 Message-ID: <20220215144241.3812052-21-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: 1ec5891f-c381-401f-e836-08d9f0918002 x-ms-traffictypediagnostic: CO1PR10MB4689:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4941; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: jFEyAc0ieY/8Hzx3sV9VCDNZRnHuWNY6h07RErZG5aDJt1cdS8Au6whW2/SfFZBqECoNrQWWsCr61wLGPmEvL32idkj63xeR+JLGohBfbn4QWH9InLqBvDTBxuGk3U9CH/35psg/mYuFEZvwYw+ET+9RgT1syQSyGK6Qjc8K55XxH+I89zhZJobAG5T7Oh28croeYXMEr0fPZXPC9XrJkFseyzdIl9+3yekc8sBbQa8iXy4AuJslBrXecjmcyOdp2/08LffgGI4lceiVG4DTie2JJNPaDJB978azBoxDOScyY5XM58loyyhAjGqavSrZAXpOiFREmcSjpo/dYkmFeeGqyc2Vv2I6Tv2K5Hk83G9B51K+8dvoDw2hrjvhzoWKFay6mDhT209G/HSy6fCF701vXpR7GFybEmkN1uEH1AffMrM0BNZ1+Xma2JpMLcJiN9MyRi4FK+k/rARIi3RZ8B9DVhBLzYX50KpOOmlPG6j2ieV5XJMnaxp+kcKU2JVZjhXGWJwlq9fqVeZpRMcT8FyNVEffoCdWY8Ul0JJo5qCtimjUhVEiOI6iU4PVd+bGfT6I1Ae7/JUqJs3KdtaQU5pTLE1N6h9UD5lqvptjuVd7kQKNQz7Utyg8NhYfR+W514T87Y3AFEFNkXaIzbHokNP21dbUI3DpKD3paqqwqPMC+tgmLb9O/gfzk8f1WVmoKOhyDwy0EmYm37pQ0xxJ6A== 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-messagedata-0: =?iso-8859-1?q?zClYyGP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?iso-8859-1?q?5ctiLgx0duHhNsWAOR4WVNc/L0XB1j5oiiEfpTmRu7cpa/fXe2lJediGi0kV?= =?iso-8859-1?q?9KBz9MXdCGBMXEb1/jkXLoZ/cNSP+TOYbOIEeUxbe7VlJft39hxH85PwfzzJ?= =?iso-8859-1?q?CNiUQ4MxOXYdObRcPtlygEsHRX/4ZvIyXV5C0cmd28goHUo3uxN45o7MgPMu?= =?iso-8859-1?q?DkJzFGXsZw/0PXAcw1X1QcpMXjELbdSq+KoCdImZ5unsgMAjfkulEDca+8bb?= =?iso-8859-1?q?e6XTB/7QhgQqaBpPaqIPYqsK/Z0EW60fOoa0Gc6P9qRFF+sn9N2MriUPa8/L?= =?iso-8859-1?q?FMWrSDppDd/+dyx/QEiOtC7rUVoka+rW2YAm4y+rV38R/P6djiz3W5GohaVq?= =?iso-8859-1?q?brA5cVB9s02eVe+e7T6b022pcVADbMJAU2TD3kLpzjZ32wq/J53vNHOVcdnk?= =?iso-8859-1?q?pnUUfU3LgVbbwh9MHuaglFeBvpABVLqYz92/IeOJ4vdaG3CJivBGVIvWz2k3?= =?iso-8859-1?q?hdFOyMfiWm1+gCEIgRj5vOsfjqIR1eAD7WZ8Wit8aM5VdBtdlH4qxIRji/F9?= =?iso-8859-1?q?yqiuN1Cyrbo9++4lEn+ZZzfIeMMfB6jiXwnUksEKVkstTqaB/kvLlNjmklUa?= =?iso-8859-1?q?j+wFAqN9tGawJWya4IrH+NFZ7sI5H4SVFwsdzWFmA59DpAsxuoTXNSxR9gO8?= =?iso-8859-1?q?h3FKeqUJuJXVIN/8dZmDsWInc9mxcDgy/ILNsuAYRAGr2c2j6hF+cSscOoQf?= =?iso-8859-1?q?PfEigOhufCt8EOalp47XTj3bIzKj1lWHbPCwFv3Y+KeCcktQuVDI/Xax3xHk?= =?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: 1ec5891f-c381-401f-e836-08d9f0918002 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Feb 2022 14:43:10.1050 (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: 1faxnDSRF1AOUeAqYdsZ8py1LDSVPiVbcO2iWYsBolayBqMIePJamvIPG7NhCMrb9Ul5VuvZ0pfZT4+66oCN5Q== 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=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202150085 X-Proofpoint-GUID: tR765zlDMCqIhVWLeAyi_OdnuXNDxQ8O X-Proofpoint-ORIG-GUID: tR765zlDMCqIhVWLeAyi_OdnuXNDxQ8O X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 6B46180002 X-Stat-Signature: d4x9nsooxk4x97f9g6qg9oakaetdy7wr Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=ZCTMSAjr; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=P1X4ST4P; spf=none (imf30.hostedemail.com: domain of liam.howlett@oracle.com has no SPF policy when checking 205.220.177.32) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-HE-Tag: 1644936199-161448 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" vma_lookup() walks the VMA tree for a specific value, find_vma() will search the tree after walking to a specific value. It is more efficient to only walk to the requested value since privcmd_ioctl_mmap() will exit the loop if vm_start != msg->va. Signed-off-by: Liam R. Howlett Acked-by: Vlastimil Babka --- drivers/xen/privcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index 3369734108af..ad17166b0ef6 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -282,7 +282,7 @@ static long privcmd_ioctl_mmap(struct file *file, void __user *udata) struct page, lru); struct privcmd_mmap_entry *msg = page_address(page); - vma = find_vma(mm, msg->va); + vma = vma_lookup(mm, msg->va); rc = -EINVAL; if (!vma || (msg->va != vma->vm_start) || vma->vm_private_data)