From patchwork Wed Dec 1 14:29:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 12650223 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 AF6C7C433EF for ; Wed, 1 Dec 2021 15:30:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F1846B00A4; Wed, 1 Dec 2021 10:30:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2525B6B00A6; Wed, 1 Dec 2021 10:30:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 056456B00A7; Wed, 1 Dec 2021 10:30:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay038.a.hostedemail.com [64.99.140.38]) by kanga.kvack.org (Postfix) with ESMTP id 8BB606B00A4 for ; Wed, 1 Dec 2021 10:30:33 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1BB58238B0 for ; Wed, 1 Dec 2021 15:24:16 +0000 (UTC) X-FDA: 78869596512.01.18C725E Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf28.hostedemail.com (Postfix) with ESMTP id 8129590000A5 for ; Wed, 1 Dec 2021 15:24:15 +0000 (UTC) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1B1E7UVe017207; Wed, 1 Dec 2021 14:30:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=9ObRSYk9lsRnVNBTdeTxR3LZiTEewPZwd6ohngB/Qc4=; b=lwo2AfbItl9CzswO7pBkZF43BEWvTuZexYHA54QeMv2iiRgfM0gzo54l3jxd4kiyvkd9 arveWJ5t1xg88YNb9DoRw8sGfWe8dtpamFJhMbDLCqCP7jK5ceduu82YpowxkgIeQiuQ FKnngu5a2WvAco2CEIM2i5BF9EOEsu09KliAtEq1TFjm6808Gr9zRauLG0GFHPDIg/Xq QDQ/Aw37h/PK2zS9rgunodNOy4V38U5HKqs7+oiFh6B86w6SX60cZGXCKCweoa0jhYK8 fod+lufdn/EU/2/yidG3zprnWOG2lvBnshv6BSYJaPCh3OitXp1/oO3FS9DfCZO303vW VA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3cp7weh2qn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 01 Dec 2021 14:30:12 +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 1B1EBMFS049269; Wed, 1 Dec 2021 14:30:04 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2175.outbound.protection.outlook.com [104.47.55.175]) by aserp3030.oracle.com with ESMTP id 3ckaqgkcte-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 01 Dec 2021 14:30:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PfMs0iPbQTzhQcMRFlEwUc1nHN7g5XPip5jdekz1s0IPnBCxLI895moMMml9530t8qYBCGagzuVXzFDQRRPlSW0qllH2wfvcFoFAH4dbZtIw3G416Cod1jYeUujgzpqEaGfKmFWaa4oPQ4/q3oGJfVy3MGzHLrzmWTtGqRdVyItf+MCFk2R4nXZZG7gV73wUg8BmRQ0Zc8JOO8JOlk7DeZuzzQzNlRzHap2VkMTeCPoTgU+pSYGDOm+mF0ryq+eXPDPUkokf3+l1u2JEilw18IYWuSf4SZfdp6bNtOJ0Q12xIPMEJEkxEZuWLMYBKOsrMiPXe93l+tDAZy7sFOjoPw== 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=9ObRSYk9lsRnVNBTdeTxR3LZiTEewPZwd6ohngB/Qc4=; b=Cjne+uSMcQ8xgaRf/dIfdjPjeLYYv9Sc/CfPmpidekzy7IkfG+LSQ6HqSR9dgC11kdXNFkiJPCUiYREdgbCZ6UfmYZHZly3iDrYcva56ZkYTzJZoyLQrqBpZHmQjgeGhchnpU5DLwOaTayhM2NrYgCpdU0pYZ7Km92/MGPRwQQ9Tc7h6acaaZaLG1WPHoQFrcSfEfkWVDitxzme+vHZF0Px7SJovUfWkYzfOs5hMwBjlKOLF7MvpZxpUNlThkrA4RPkE5hFXtC44/dfgRXuMB/YLb10jK8OpyLmjNej1KJftoudRq/mMpWPM1yDqisJqTxi2r4+LJnP5jiMh7HxaOQ== 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=9ObRSYk9lsRnVNBTdeTxR3LZiTEewPZwd6ohngB/Qc4=; b=wcnCcQ7bzej9iCWFWuE65ojvoDmwzgCbpEimvaCC6i55tV64i54LmFKVBx/71L3vTKxOxjcx0agiqmSQeXKwrJkIaxFIJf4qYYxIAyVQECOjVd7sP8Fi3mvAS+Og45zPntrFQzDMxewLl0G8nSONJt+yppV0XL6413hO28CwLMQ= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by SN6PR10MB2768.namprd10.prod.outlook.com (2603:10b6:805:4a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Wed, 1 Dec 2021 14:29:58 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::c4d0:8291:84d:ac66]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::c4d0:8291:84d:ac66%7]) with mapi id 15.20.4734.027; Wed, 1 Dec 2021 14:29:58 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton CC: Song Liu , Davidlohr Bueso , "Paul E . McKenney" , Matthew Wilcox , Laurent Dufour , David Rientjes , Axel Rasmussen , Suren Baghdasaryan , Vlastimil Babka , Rik van Riel , Peter Zijlstra , Michel Lespinasse , Jerome Glisse , Minchan Kim , Joel Fernandes , Rom Lemarchand , Liam Howlett Subject: [PATCH v4 20/66] mm/khugepaged: Optimize collapse_pte_mapped_thp() by using vma_lookup() Thread-Topic: [PATCH v4 20/66] mm/khugepaged: Optimize collapse_pte_mapped_thp() by using vma_lookup() Thread-Index: AQHX5r/qivc99rDrbUy00nA5hJbASQ== Date: Wed, 1 Dec 2021 14:29:58 +0000 Message-ID: <20211201142918.921493-21-Liam.Howlett@oracle.com> References: <20211201142918.921493-1-Liam.Howlett@oracle.com> In-Reply-To: <20211201142918.921493-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.30.2 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 468a24ca-32a8-4a24-6b2d-08d9b4d70d6d x-ms-traffictypediagnostic: SN6PR10MB2768: 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: KzZKGG3ZdTn9TtfF+g7arXPPJYGdvr4EzDiuyNU8TgSLwwDq/r+zXsqsXhiPXT1nw6iYzH6hcTwHVkP1IEFwgKIj355NEtuKx7v73oBi/iTXWrj0mh5YOL5Ci1bf9sTDdZrI6aux9HfI84krMLUoyoe2Qp0XBbeWNkg8L8Amo5MlC6XtA4Beb3tAiDCumhtdFKBL1eyv9d4xzW5c55yQ8kqSh3r1u4RbUXkdDkobOHAd8syClbsNY3WJFVDZsMevlRC+FmLdBalNySw7bB0AWLXVNb08qktgD9FG2UlKl8F7gvdJlSDaHcS7myxYitIJMnCurg/Jsc6LdUpTOPoSIejyQZWGlSy56F55ICH2omgsb5OpzGUZrKOm7Z/YIvkbaLa7WlGnQGxw6iQ/bJ7kfmGds/kavLhPoN42NyirinA2aY9uoG/Jr6/13J8cg4h8KBHrUMHIMVfXRqRfx6I25o+FdCw5KHBxMfdbOdVSeHU2wB13gRh/e11yT0X3IZL/uIR3r/PsJsL76vAQjQZp6O9r7JiaGwEsPBBe8KNa6bZN9W6WzIuA4l/9dobhWc39QMuZ3qxPzb68o0uF7s2Ag0oRPvQd9zY6jFhWUmOyNxGH5qDJnh8biXAYDkngonYjg/EVd1XcxwVYMXEOxga1C1J1bIBioZ750wTboX9xEMDMLBHv00SMIRlkGxZA/E+E5Kp7WKe5taqMXwpAAmWPEA== 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:(366004)(6512007)(508600001)(66446008)(64756008)(66556008)(66476007)(44832011)(7416002)(66946007)(110136005)(316002)(36756003)(4744005)(122000001)(6486002)(54906003)(2616005)(4326008)(186003)(91956017)(5660300002)(71200400001)(38070700005)(26005)(8676002)(86362001)(83380400001)(76116006)(2906002)(1076003)(38100700002)(8936002)(6506007)(107886003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?jO0W/3f6sVJ7phfJ+iTL4on?= =?iso-8859-1?q?GZmF3JkLZT3EpdTdosPq1DRMtWUuru8A2D6Iy5z08jndI3XI+f/9pcFxRdNJ?= =?iso-8859-1?q?nX/jCk0IHZQNLH/xT3gYxgjfaj3zyeqrP7iPU0OMmKUYOTa8jf/z6Ygc2TGH?= =?iso-8859-1?q?hStJwCmwm2jbPRly5JBbKq0/40OHWQKdSreDtKWC+heM3RjaUiZvF8OxG5xj?= =?iso-8859-1?q?BpuqZKZCHWpLpmhvbsxxSOyQCqLp8+yzetN5RK2zI6xn0bFZbce29MWwFOCg?= =?iso-8859-1?q?J/3XvgfD/zjfdA7TMyjSQ2LeDYIE8ChdnPuaDQzv3yfxCCg1wTId3XguCNYw?= =?iso-8859-1?q?BWpeOijkpbZyYbhOSDCJs3RvlGU/qvixtEeRsd2g7hQp94wgIjiyHRZiI9SB?= =?iso-8859-1?q?95ZyxekLkGgdEqAUdnTuB//knTfn76ym1K9d3xn7vc+r/9jq4rFBxjvrEpuw?= =?iso-8859-1?q?HURelgGyAS6TJz/ydNKTY7P5fX85GUdIkFZpVtcllV6sMfWaXbjCu/jzJft6?= =?iso-8859-1?q?ubtJxvHSFcMEgIozKRfFj/aXI17QI47uOSaAradWUFl8AMg0sUJoJrGGi0jt?= =?iso-8859-1?q?hdkw7CbA6CNJNNIS6s7+BsVYGtX4WYXgMy91LxSWK9kNpWLXp5q8z3sNzlv1?= =?iso-8859-1?q?f1oP1QC3f3xa1lygVlRTBvgF7fqWGmA9ttM7mvhrzz244ytC9WDuFhNlkJSX?= =?iso-8859-1?q?LhDkpj5QU1Qf0KL7NOssaTjx9OtLupLJAz9MletYeF6aXgGnnropIq863f4T?= =?iso-8859-1?q?vVJzgP1m+UABFyuVrFqSio3s1CYsFqgnIr7K0dWHclH4VC95Wb5ojF+FMKXk?= =?iso-8859-1?q?6UHnj/7RKdMNZvPlvVgLAzXQStCHa4Es+wufLFV0Mfsjuhya6TpYwzjkPqUI?= =?iso-8859-1?q?tVQ7WPacbC9JTnfRgklxPDI7RWgGVrcEm575q3eILXMBa26KiIkX5pkXRHQn?= =?iso-8859-1?q?ZCIy6qbdTCODixNrmpsWeg57whW/P4AzYARGni65QEO+B+hJJ/umiodDXBLL?= =?iso-8859-1?q?U1ki4HK0A/YlIzK2MEJD6EG03fqpTDQ91BbC59VbiN9FJ6e4yUFLxctZ4XfH?= =?iso-8859-1?q?nND+i1OJlAvX+j8c4XFnNqh+EWyPIUahLoftlopDvDOVml95bTQISUmJdAaU?= =?iso-8859-1?q?kSlAaEaul4o2fsyLC30eRR6k86m3bGLf6o+1++B4Zbj49KSsg6PxMb6sZi2D?= =?iso-8859-1?q?xkBzruunhWs3evs4dwLAoG0Tpqb188dO8YfUbeMAj0QwCK0I7lVAJa0Se+Pq?= =?iso-8859-1?q?nVBEwwR8iGwVdWMNrcqq7VIJEAyN1cadSst/iimNfijatPgY4Fegkpm0ejj2?= =?iso-8859-1?q?m24B4lpmJkvZjgj9qiVPopwq00RDAScjuWEy+zisIFq28K1eSiM/S6Mfpf3O?= =?iso-8859-1?q?UhdnGD1Sc7xVSUAXJ3QcCRYrdJgGu4qFe9RIHdMrkwAfupUD8+Hu4rQOikHy?= =?iso-8859-1?q?b1lRqr84bgTNfusPgjDi08HLX9xmb6uS37Ez/Aas5Qb7AqN91voDmxR1IqJN?= =?iso-8859-1?q?lceOzRcYlAbE0mq1upn8VK7IcgVy60MapyDd3wA8aGGjdRCl0hznsi2Rnizn?= =?iso-8859-1?q?zojsZa5QDrzJByNi5uQyQlwhJRXy8+phMhTGHGoE+yvjX0UVSyddPSRHtl6W?= =?iso-8859-1?q?Ob1GySRCIarJPLH0j8J2lUOmxzNtkRECx6wSD3rMzAKsF5qG5jMzA+3cAXdQ?= =?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: 468a24ca-32a8-4a24-6b2d-08d9b4d70d6d X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2021 14:29:58.4639 (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: +aRLcioSimdID4nKoSMvsggcV/hubsu04YH/mzyqA9vYpOYG3IHe46BgFMd8FdP2UbIpgINMpXmn+gPFHQuVlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR10MB2768 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10184 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 mlxscore=0 suspectscore=0 mlxlogscore=893 spamscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112010081 X-Proofpoint-ORIG-GUID: JI6wVcooDAJd7EEh_tpLxTcrp6tO2EZn X-Proofpoint-GUID: JI6wVcooDAJd7EEh_tpLxTcrp6tO2EZn X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8129590000A5 X-Stat-Signature: jgm554ffkzx6xyfs7dix96setc7j8o7y Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=lwo2AfbI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wcnCcQ7b; spf=none (imf28.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-HE-Tag: 1638372255-720711 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() will walk the vma tree once and not continue to look for the next vma. Since the exact vma is checked below, this is a more optimal way of searching. Signed-off-by: Liam R. Howlett Reviewed-by: Vlastimil Babka --- mm/khugepaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index e99101162f1a..0ff7d72cdd1d 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1433,7 +1433,7 @@ static int khugepaged_add_pte_mapped_thp(struct mm_struct *mm, void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr) { unsigned long haddr = addr & HPAGE_PMD_MASK; - struct vm_area_struct *vma = find_vma(mm, haddr); + struct vm_area_struct *vma = vma_lookup(mm, haddr); struct page *hpage; pte_t *start_pte, *pte; pmd_t *pmd, _pmd;