From patchwork Wed Feb 2 02:42:13 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: 12732541 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 8796FC433EF for ; Wed, 2 Feb 2022 02:42:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A05AF8D00B7; Tue, 1 Feb 2022 21:42:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 98D948D00AF; Tue, 1 Feb 2022 21:42:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E1028D00B7; Tue, 1 Feb 2022 21:42:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0037.hostedemail.com [216.40.44.37]) by kanga.kvack.org (Postfix) with ESMTP id 6D7D78D00AF for ; Tue, 1 Feb 2022 21:42:51 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 382971826A118 for ; Wed, 2 Feb 2022 02:42:51 +0000 (UTC) X-FDA: 79096292142.04.1A21A72 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf22.hostedemail.com (Postfix) with ESMTP id 7B396C0004 for ; Wed, 2 Feb 2022 02:42:50 +0000 (UTC) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 2120TLCV011400; Wed, 2 Feb 2022 02:42:50 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=MmGflBQkJQ09wytC2Zwalav3W8P+NhN/2lNqTYtMJv8=; b=sgrEwB3DsbiIc/janVh7GXeSRO2Zkj8mE0wY2in6AOPSPH1+ndh4JpvlDnv/9TzzuQJF 2GUxWFHUir9ssu/66/tam6rf/EHj6YlXHU2tRIyS0f/1YuVbhhU6ukPk7JDkhyQ8wadA L2W4E/iSCQkXs5f4HEyzfIqakBgStybuJ7G6634KBEuJBtQ+WTIdMd6uZcGDxy/Rt1H8 /hQgxycWotvkGc4QYf+0Ji8ga7ziAvSY13KRlVbThNP9WR9ILYjk9gBc3HPQwOWoNgxR hBi6Ysx2EnyLRMoPZ7pIYtUd5tc+qODkhZwAQ46Cg+U3StvCBCFEAQMhYEaZ1jcfM4KV HQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3dxj9fvseb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Feb 2022 02:42:49 +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 2122Zwec015318; Wed, 2 Feb 2022 02:42:48 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by aserp3030.oracle.com with ESMTP id 3dvumggu7d-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Feb 2022 02:42:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gQJeLG3Zpk32MFyOqbjUSkLJNFNQ6FuCaUC3MNc+PSr42nOTQGCDA3AZLPcvx73NXaDJOTuFH68YZZ2w/5j638Re3C+1Ri51vuiwiA8opGQY303jMF5yyXOGcJMK6I1HTCLqlXiLw6Qwz5SbgxGSWl0BV/PJcbkItq9GA1Y8E12oes6Dz5cJb9T5Zimf+bxrjJl2JXMDbxkW7rKbJ29ARhVJ3rSriu1Lxj2g5WqNlrxwFTcTZbpYmJdq5p2P7KScqMhoIijSjUYOI1eW+nKa4m9/NpCdD1PyWPVhcwg98JRkDE6cAWxrZ8Ivzjtly50DpLj7gBwafSusYcmndD6GHw== 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=MmGflBQkJQ09wytC2Zwalav3W8P+NhN/2lNqTYtMJv8=; b=X5pUT5KAr81H/4q3WYMKqRktG8fhiScl8iNxSDbMJO07RW9FFlAbMABuLKT5MijFYDmu6HktdoVF/EyJH6L0o9DTzFPZvKOJeTlD96lsv5WfhsE6goKkIJhdYpqGGoXGe0XQIGdaTw3OJ6wKb52VC5Oh6Hi3+xFB7UbxXBH9NejBxd+AOLe9yul5i6KdlrIIPOomXKHMTA0kSrxgweNTs4TDDRh0t0T7y4S9CMlDXzEu7BGezaHY9PVgeGD/Ic/z6N7OxaZHYHJo6IhC6w78Z8gWo9E48mPuysHs1sGAeuSMpq51Zp2j5OYQZx0WeXUwdLAai8wPEvuNVIm8Kj3xYQ== 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=MmGflBQkJQ09wytC2Zwalav3W8P+NhN/2lNqTYtMJv8=; b=fbn+mc4ySBH3sNIdaUM/EtKIAq5irTkSic70DcCD6M5kxhmn2dnu62jtwH2BdndXiiPpizEpHnUMw4mYpXbq4YcAUTWoYsUPEnHcIreTPZK7RSca0fseZF9XevcoC3PKy4K8eqVXz3uDqXzJDX1HoxMFWioAwCQINsBVQe1coXY= 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:46 +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:46 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: [PATCH v5 35/70] x86: Remove vma linked list walks Thread-Topic: [PATCH v5 35/70] x86: Remove vma linked list walks Thread-Index: AQHYF957fXQogRVgFkCVx3m7VRYj8w== Date: Wed, 2 Feb 2022 02:42:13 +0000 Message-ID: <20220202024137.2516438-36-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: c0a9a791-756d-41c7-490d-08d9e5f5b1fe x-ms-traffictypediagnostic: BY5PR10MB4129:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ldocC1AQ4EX4UT+Vp1bjGYIbdfGt0kDvU7WZgPqRkCJzb3o1q9E9vhQr39NQdZEl4UT8RGqnTK0nGk81r/gmlF/ooix2Ndn5+u9/EQQAhlnnuuySam/J8c9/2EhcwuLXYCmn5vkyh5h7Czx+UAwuvaySoyBIJzFB/jvg169F11e+qh6EvdnT1FEh4FSboqh0Qp0IxNUI37g2/wBwo79wcw4uKCoZgv1UKuRyFN9zQRwMTZmNdJOA9owuciKHFkdgOVp8G1BjCAN4TEC7otFcJnJtr1XroMed5D4ivouQdpF3tSmUf1Gp+c5KMqHURvmbFKy/isoetP9WZhda31yMMDIKFWfzFiiYw2333iCAXIi1+8mF0by5Petji+v99a9L9h8LnZhjqXy0zG0A0BwdiJAtV0W7Mtn7YQF5h765kvLzkLvICqzuoDbo8J72wthAkkjTUOfSMpo0jdNKFsl9lQJU9Sq9fr0p1Ezo3VpB8v9BUNSr9mZoVZg1FEnQ/UWerb824nBjG/gH/nwIxi/rde8q8TRAeAVTqFNx8HQjz/69NKRFQYR7aCZlz32xqt4x1Ukzaqd0Hw2FLYal9zYeOmFzImG2Ggzr2S6neq6hN3cXk8nI7c6ZG0TaMSkNJlNsKzq3J5d7nMFQO4TEicsCI6FsIpqYSamCImjN88PFeMJ3O3R6q2d8QzVlgMLjBvPiLue5e0vsGFpcSBnWuXateg== 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)(8936002)(2906002)(8676002)(66446008)(64756008)(66476007)(66556008)(76116006)(2616005)(66946007)(5660300002)(91956017)(44832011)(6512007)(86362001)(71200400001)(6506007)(6666004)(508600001)(6486002)(83380400001)(38070700005)(122000001)(38100700002)(186003)(110136005)(316002)(26005)(36756003)(1076003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?NwGlIs3UxQD/CO0+yfSjYu8?= =?iso-8859-1?q?GMjVl7DsdhW2ZxCOLgjn3h9Difl1t6NTIgMhHyK4HhEcgiBmOBADCmNG6Lxa?= =?iso-8859-1?q?L2l6anuaFYpeKVTznml4yaJqjL1/T/Z7J76o+hKJl+e3gj+Yt8ZyewpjJHNt?= =?iso-8859-1?q?ChFHppm0upt0mvJNxPDIh/1zpJuABctXCW4c+k9MEJNXoJ96flYAt+yPIdF9?= =?iso-8859-1?q?NPQ96mLHPAygirs6xgbrWIoRaKyI78+FIE36xyEi+y9gzUPSXPgD++BBOMc+?= =?iso-8859-1?q?UONti1wVr1vg7zlf2p6pAzqnlaq3AMn915+n79OLLo6rYwkIW3uPsWJQTdeH?= =?iso-8859-1?q?RtDRa5nUKuafjqUw/vs4OEPobXODvBmzjM2Qu0QH0giXA5Ycs3Lx2lqBDjUl?= =?iso-8859-1?q?/qg14KKOmHcwIq8SwwMcq0t2VJi+oDLyco8r0q0Ti5e1WHedCdjjlwYzfv/j?= =?iso-8859-1?q?ee5wqmk2lhi1VyYVgQspGMoSX1CXlfUSIsPDF26+dPTw3qy9eZPd5oIrAeYe?= =?iso-8859-1?q?shRSWO3DWvhinBlpqO3S8wz46OqDAvs338Xum+X+lw3bM2KeYcGUlaNllooH?= =?iso-8859-1?q?5Q8CHWAik4oA1SLBRhqtyVnIK5XfrvMLXRZZON1RMwhEOoah1oT93GI27YGo?= =?iso-8859-1?q?BleALSrPUyZuw2xRR0eqyAaZk8+Hn9rmt4/bbRrGnojkvanoRXID54JMFriq?= =?iso-8859-1?q?ftTcXW4hR5w3VXEM2VoYObIJ3of/+fm6ysQb0ancttD09MCGOI1ZOaPc6Y8m?= =?iso-8859-1?q?6K+mIf6i8hFXI5e32/A8egiB15X6+OXS23xX6YzFlLP/5DOZQQNTbVZPRMWy?= =?iso-8859-1?q?A72joFFFeOPmDQvBqQMSQfjYC9bU+1JjDzJ1/2AWzerxBE31wbxJAekZNDdo?= =?iso-8859-1?q?LLHpJdq57nCjF94h5XNz1DLFTeczl1k+ncjFtxzAHxdB0OgazeM/ce+TRrv2?= =?iso-8859-1?q?iGbPeKbZYvnYxJLnyti6Lv9cg/ERpxMUpd/hVvlPO/bYO0ym+IyrCDVuZ3XU?= =?iso-8859-1?q?VUw4vi9hIdiiFvw/sacPOloczVg5skfLQbzysmXdhWW4OKO57wBQht2X9piG?= =?iso-8859-1?q?Cgeg+gLHTDhlQXvm/1A96IRITAaBQMoZcQV1srZQkaI/F45TorYubfefWQx6?= =?iso-8859-1?q?+TGOELHXqSCho93Mg+dL4kRZ7i31yPqo+MAzNi6UaNbGeR4N10Bzyy/qJ28W?= =?iso-8859-1?q?sYsmbhCThQN70yu5UtEzKck7DJZ6COeDKof1yJ3DNIxgpwEk9fhrbGSx2Xa3?= =?iso-8859-1?q?ZGz9wKNt8pNMo0lxKxWQRo+fI6tUrkpkEV6q8rY+GkHZEfomRxtAvWtMOm0C?= =?iso-8859-1?q?kqH/5gTVJZmtfZg/iaQLF9uTx0Fbg2X62vPVIZAakM4xRKVokypUSW6E+ej4?= =?iso-8859-1?q?3ky3wvBxKWmYC+q3Rbra+QDUBPh9s4IdesTkbCSZGTibU1NEpuCD1Aw1UchR?= =?iso-8859-1?q?+2fms06NQMab+3+Q7nlbHOKsQE2LXIBU+5yhzH4GwAjl9yZ306F/wdmsrniP?= =?iso-8859-1?q?3V4Z2njujZzv8ygMqGq6T9ShQPpV6coD2RjzsOuYUVnAv31ksElBykiCJM0W?= =?iso-8859-1?q?xIuJHQ2DtGeVRwoKdYggV/RY+wVILWeRTEN48BCSOazqCEitq1dMGPjgSM69?= =?iso-8859-1?q?nPqXv3W5wf0kms+JdmXRQqvF0jq9EVuV60DZfcBBzcm2BqAQ1K+s188ZCUH8?= =?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: c0a9a791-756d-41c7-490d-08d9e5f5b1fe X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Feb 2022 02:42:13.2513 (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: PkvyPuXjaRK7aAIW07Z/EOU+OQUroM04eLMlyrTC3BT5Kha6rh8nOdPhdy9+GmRjpqKbcXaN9QWb7f2dTbkeJA== 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 malwarescore=0 phishscore=0 mlxscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202020010 X-Proofpoint-GUID: S7UsT13IZeQ0ZQdH-rcofvZrPoRa7pcc X-Proofpoint-ORIG-GUID: S7UsT13IZeQ0ZQdH-rcofvZrPoRa7pcc X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 7B396C0004 X-Stat-Signature: g4e6dhnxh51cojyj3q66wifiy5xhahfn X-Rspam-User: nil Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=sgrEwB3D; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fbn+mc4y; spf=none (imf22.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: 1643769770-55252 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 the VMA iterator instead. Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Liam R. Howlett Acked-by: Vlastimil Babka --- arch/x86/entry/vdso/vma.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index 235a5794296a..3883da001c62 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -127,17 +127,17 @@ int vdso_join_timens(struct task_struct *task, struct time_namespace *ns) { struct mm_struct *mm = task->mm; struct vm_area_struct *vma; + VMA_ITERATOR(vmi, mm, 0); mmap_read_lock(mm); - - for (vma = mm->mmap; vma; vma = vma->vm_next) { + for_each_vma(vmi, vma) { unsigned long size = vma->vm_end - vma->vm_start; if (vma_is_special_mapping(vma, &vvar_mapping)) zap_page_range(vma, vma->vm_start, size); } - mmap_read_unlock(mm); + return 0; } #else @@ -354,6 +354,7 @@ int map_vdso_once(const struct vdso_image *image, unsigned long addr) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; + VMA_ITERATOR(vmi, mm, 0); mmap_write_lock(mm); /* @@ -363,7 +364,7 @@ int map_vdso_once(const struct vdso_image *image, unsigned long addr) * We could search vma near context.vdso, but it's a slowpath, * so let's explicitly check all VMAs to be completely sure. */ - for (vma = mm->mmap; vma; vma = vma->vm_next) { + for_each_vma(vmi, vma) { if (vma_is_special_mapping(vma, &vdso_mapping) || vma_is_special_mapping(vma, &vvar_mapping)) { mmap_write_unlock(mm);