From patchwork Tue Aug 20 23:57:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liam R. Howlett" X-Patchwork-Id: 13770664 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 5CC48C3DA4A for ; Tue, 20 Aug 2024 23:58:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E9EA6B0093; Tue, 20 Aug 2024 19:58:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 346E46B0099; Tue, 20 Aug 2024 19:58:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0B07D6B0098; Tue, 20 Aug 2024 19:58:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D362E6B0093 for ; Tue, 20 Aug 2024 19:58:13 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8414EA78B1 for ; Tue, 20 Aug 2024 23:58:13 +0000 (UTC) X-FDA: 82474290066.17.4B7B058 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf02.hostedemail.com (Postfix) with ESMTP id 8E74F80011 for ; Tue, 20 Aug 2024 23:58:09 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=FMWW41EM; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=dvyCKn7P; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf02.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724198231; a=rsa-sha256; cv=pass; b=Mer+Zt6v18hP+P0ic2oiDVo/5To6bAFeN4d8GkAYIIarrFAxr/RQVk0U2CIKJqkLlSbrQ2 TBfQPdwfbWRyYg4tIVrqgae1eewS5Ep9l6YonU27d50znZvE/iHLPsUasu6+SujuFj/MYa WRplZulN8yzJCajSEX9lbbH6WSvpLwI= ARC-Authentication-Results: i=2; imf02.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=FMWW41EM; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=dvyCKn7P; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf02.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724198231; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ttsU2jqtp5fvXasFNgS0NAcV2R20c5Zpzh7VMtrTw7I=; b=56X8T/loi3DH4YSXfB6LesmSMJY9P0HOSK6JHflO3dvQ2eDtk1xMAZC23koncPNWF5tDak K8acYm04MYOZieOByrgKxxP4w4Dr71UigmuyUF+jfHroAqubOwrb3Un3GTRMsoeTy4PSd/ TKuY8qQfghEDsUqBXdI2k7QewykQgnE= Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47KMBXE3005239; Tue, 20 Aug 2024 23:58:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= corp-2023-11-20; bh=ttsU2jqtp5fvXasFNgS0NAcV2R20c5Zpzh7VMtrTw7I=; b= FMWW41EMAMgYELv+Yrv7T7SfOamffpGVZbFCt+Nev/BVC8zc0GA/9ub36ryyuHPS X57WjyKDt9K5bkk2ia8XgWk2ytqba6G8xNbMd4rAgwP/ciykduqkKFgP1IgSIqEu 9Vq74lUJtiRqvs07lRNUTJXhxVFhZUyQPqUCddtLhDO4xdLk1O05iHFJyq1jhzjF 14oBayeSZ5asgpgJ+9Co75a8mBePSGWpmM2HHVEN6VVVTLufWLjX1Rfyr+vwQ4jw s103NQ2cfLznNNrO8HD24OJYzKIOXUbgG6oy4CXhjiWnLKLp1VWGiLI86P2RtrrL nCGQ/QEjcJZd36cvvxBcDQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 414yrj0mm6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2024 23:58:01 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47KMJJCq040079; Tue, 20 Aug 2024 23:58:00 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2176.outbound.protection.outlook.com [104.47.58.176]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4153u2tbed-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2024 23:58:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=e337Fl4lN/Q7vg3uAuv8DiybjJUJ+Uj34n34Fcde9vA6yZ6GE5uFVmlorZWEFCDfYZp4+gzFmpMVTK6OFqzHfLfXwIiusfG9SMI8UA0Dlo1TDTENDwLvmsgk7GDAxtA+zVqQUfD2gikBL/wI89n+uSDljte1KmTp//1A/9Ne73SK/O12bYY57V2HVvElFWO3ofSVLaudjiPpQb2/JKF8PA8tj1wfK24yMhefyvw2NNEFdeQS6W+kEhUXOxjiYw2lK4f8qe57U7emsjvIuc7zHn7G1EZBVfDbNPcuYJVpYG3YCNt4+iWPqyKMk/z8tnP3oyUiXsImUVeGg5ZCP8mc7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ttsU2jqtp5fvXasFNgS0NAcV2R20c5Zpzh7VMtrTw7I=; b=xAt9hqAmvH7Uid/ZEAF2IvEh6Inw+e4LZ4gOtSGSr+74mlJJ7UUrU9pq3ktRbkzTFj7JYQ67yljkRmWW4ModTSHxas/RbKRAZ6Xh+sMYzCH7tafJxG85XNpXo+IwZAH3RngFEnAxawrAztQVPmvXlEfnfWIHDCjukYSj/Dus2+MaYT9doh3825M9GfiVYh/HvqNKo+e3uWY1QPmbP3CidvDc6XFJ57wlyMLbhhNAKjaOCUWuMI/Yvk+Vgvb1tO4qQQhHd5/0t+OVwBk2GGwznzD8zVR+lPfDAHb4SZY/sGf2sMTXyrKsS+uuT3NOd7tanVBN6hgqhSTzEpugfBaLrA== 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=ttsU2jqtp5fvXasFNgS0NAcV2R20c5Zpzh7VMtrTw7I=; b=dvyCKn7PveBsNQCpLPh5HG/IBBUfks6lCDX3I9horSN3xxwZtQyeGozRc9grGn3xD3DI8+MQJiMRVRwZiRKzuzguIC2EE3nUi8+knKpQGzTIB3fhIemqc+ASqGkwdGjGF7lxvuskooAOdKZwE+sM75yMLiPZMPdjTJpqDx/ihbc= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by PH0PR10MB4757.namprd10.prod.outlook.com (2603:10b6:510:3f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.13; Tue, 20 Aug 2024 23:57:57 +0000 Received: from DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490]) by DS0PR10MB7933.namprd10.prod.outlook.com ([fe80::2561:85b0:ae8f:9490%3]) with mapi id 15.20.7897.010; Tue, 20 Aug 2024 23:57:57 +0000 From: "Liam R. Howlett" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Suren Baghdasaryan , Lorenzo Stoakes , Matthew Wilcox , Vlastimil Babka , sidhartha.kumar@oracle.com, Bert Karwatzki , Jiri Olsa , Kees Cook , "Paul E . McKenney" , "Liam R. Howlett" , "Liam R . Howlett" Subject: [PATCH v6 05/20] mm/vma: Introduce vma_munmap_struct for use in munmap operations Date: Tue, 20 Aug 2024 19:57:14 -0400 Message-ID: <20240820235730.2852400-6-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240820235730.2852400-1-Liam.Howlett@oracle.com> References: <20240820235730.2852400-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4PR01CA0427.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10b::18) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|PH0PR10MB4757:EE_ X-MS-Office365-Filtering-Correlation-Id: e7759fb6-d8ec-4bd0-bd43-08dcc173e9f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: zh7AF0ygk8UwplSDpU7ZyO2iC+5/6YgPO+hx2wUIGCvbkT/1TBeobaZRaCme29c9GAeRWepSs8RdvsqqzDUe25hIecvyHqDkM2ffrJIZ2K0RKw3sL+K9FziFCWK5796VJuIFWZMuihTrFn2/Oyio33a9SO0A0CBVOcR8McvvVI8YowgME7oaglo0iUxlT+zCx4Sb8zDHmnKs0T4zKnCsn1cKad/frmm4qVpAbQvq1X5q7nlAuvPwGTLXk6ERVcmSUQhOrDyT91Zpb4q6O5HWzcv6mIDmTDWIYb8dh0F5nwdpp73jsCCnOJUe765oMZbP2qX9qQAH9IZAUTUkltrWwF1YonEk3BOMtfwm2GklXiy8vXIAMBytEqVYv7/phdx0iBzl1Xn7nAfo+9TeTD9QcpfodNNBf080c8ZzSTyQ4dhu4Zaogv5No8rBkuQgHKDxeuVwxrHwVn38PU4duHG+/OZmugGXykuZH0jKGIRwlGsxSjvHHRddblj8gMdTWLUzMTgECeI3+0+ROi/Wqk8tKoCaOHqj4Hec5V9Pl8Rbr3Z8TL14tnJ9ni8XgnCQms0Dv8toEvpiT9ZDfDmeYTzQzGssEtzW7pOc3wVe7esTPFY6m8+KPqTcxUmBNoVaBfEv41s/go8R0+IvYRFxqwDFvlg7+NbMfkKPqr9XTW6tcPQ7hEgBb1rDICWcdDvNmbW9FBszlTCSAEZ6DlXUdj8cCuWZPL/GYtm/qmzu+EkxLnpdBXn7A31L96SzumJ+VJgiDurTqYShemWnzOMfa0RbpwNDZPPD2UNTS60cYor7jtdE+mIrAQeiHV8XQsFBxsUAKbO3HGjQ5rH/3cAvpXgHVNOyilGhOa9vK5KLAv7nq41b07jbEpwK2TPWvIn2QRaFy++WuKcNyzc3gCoYKJcbORl5Kn4Pp9OINa3L6jZoMvGIfENjO22TC4y1AF/1jzzduyQBVmHCKyxbqB8lm3sVcc4xbTYwEXq8cqoovKqM17SYvBUo3iPlV8B9nn45BuxiDBBucmpczVNTbffEIiJ6yRGpSMaARXqW+y0FU5pvdK1ATtrP8Z3JHRd5Clp94TneKo30a5DcyPFVMoA1qspoolQXE5LSvWjsL+j0tEGEoEBuRyOpGyucZoi908xjYUf9AzuwRs3y1+O/VIYA+rX4cMqQZpqlp9rEHKKHPt1LdPQY3LQn6rfEZmoiqT0NUyBB+Xq43vRZ/uH4trjwj+KZ5fctmqnLuVFv3sJ+BwFJ6uxEjeCn4tXjPJpuO0VuTsPlbYKLfhV7/bbjNIN5jysT25RNp0ylMCpeSyJD0NYqLJm9YoseGrmTnc5BWV1YiNmelegUt933JkWINIXO8Y+gAQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR10MB7933.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rPo68WCQIvg8wQg6Ns4gYonoEDyxjcQ8fygT2i5N1RRiyI/sCvxTCPTVZ0yNQXK2epQxHoEmxI9IwwBooWdilPVVV/K0jc6FhaQSuaIy9ae1tKo3Ws9CQsg89nHYZSMy7laFbcairgFaSDAOpDpaFDje49Xb/a5Dk6OFkwO2tsJGKvKV3lo4bwI9sORggfn/OLgQDYLEy72d4BKGEVnRApsc4e79/PreSFjBK6oRr9m4+XLuugHDyTCNLWI5Jv/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KXeDxY60UY6GGcf09S+KXn14Uik6hYRZZk6NXDhcdVE4MnYVGsb+Jm+6PEZrho70EVNhlVexy2w0hO4ifLbwrom81mp8pwa4zEXm8+CFovHKZMcXydjndov9Ua16afiGxbSNFW8bxPha9GbbqMVDj8Loo4FlTku+c8N/at+/Dz4YqEU5o7kG8wFEdfYA4gq4w7QWb1zPpw7Edg2fGVXyw4YaZ/CqYPJAzarnNTMFO92uRWOqd3EAB6qIN6rvWTnwOa3bHz8yZrr X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 23SczwdhUVMuqNULoUZDVZS94TzUX/f//Ecdt3FsLT7Pre2d/uqu/HxT/bw60y4whiiHZ29K6liJt8z1zNzs58iu3nuKpVurhUlxKP/dBvT+wtEQCmaq2fSb3lyruLjl7D7btyObAAEWVnzcPNsmxCCKIyuCpvZ5u5QrMcHa4BEabXWhoJAuYsLaKFmFJRI/Zggu9JS1sxKIPJzORx7cQuf8JAeuX+u2PDqcXPRKY3fWyb3dRGkFhWV04jU1LzKGtDX7Yh/TZvs7Th590poIh6tjI9zOgkRg6oIjHh0KJQPTiMGq5WJkP/WemeMupOVOFZu2tI61gjiIoP46Py+XoMuBGqCZnxSPaANaIImOJdeGmkoQoiBRx4dOOICHVr0kyQZ5R6Pf2nX5x/r4aCao+0aaVyhtofIJrtTx+THZ3qTwv3rLm9CSqBG+Fe4tVUAd1VvW8j6hVeewXFOyjRE5qMtTMWJCHDfVx8139LV4cSOpTGT3gUwCEs+PiNKU4mAQ3NSDE0w0weGt4jPYmB0W5Z09xfS+p1L7ascBPAcCXy0BAmneH7uDeJhluxZDSJhC/d90RRN00MVTNqzXkHR38JRiHr9mHZ3tvoOi6APkF2w= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7759fb6-d8ec-4bd0-bd43-08dcc173e9f6 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2024 23:57:57.1445 (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: Gh/cRlWWkbniJEuHND/A38nn2+C/XU5wEGjzrNEsiyZdwLm7U+UYjjLoU7GjdvsGEDauVNzUS1cxxyZ7if8Qyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4757 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-20_18,2024-08-19_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 adultscore=0 spamscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408200176 X-Proofpoint-ORIG-GUID: ZcCOpgqyqCSYHzYXJZ-Z_8CQ4o5vUScW X-Proofpoint-GUID: ZcCOpgqyqCSYHzYXJZ-Z_8CQ4o5vUScW X-Rspamd-Queue-Id: 8E74F80011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 55m3t4h4iojxpg4jtbrfzku9t4b6e3yn X-HE-Tag: 1724198289-420279 X-HE-Meta: U2FsdGVkX1/oNepELFvu7oFVi6FMKufp/Yk0xi5gWxUSnsJrjPRxk/PzhfpDE9DZWOZ/IUqtRuILQRDlfJq5ITNkmqWa188/HSOdFrPKUP4uAbUZ9tWPnCJEAquhAkCiPo9zooeLsB8LKDLYA5VSWX2nWOa/1WD61pqogWA0+tEg8DBZNttWrqb5czBZdSNKkNf8XjbaKmzeszbwSUp8xx0AOJsbkZEOEGL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qFokrWZZZ+dqQs3AFXiuJeCzZT1eX6bgip5LNYAR2fvFA48uGAEVA2A/jekwH0T5IW+hPdXgfz6907nydVXMLVUeApvIID/GF2Lt8YdFNtSqE0DJET/baDskgRs8pdGFLcfFkUXAVCxTb7hiqs4QkewBOJiwSyiy15mBDVRxsO5+GswPU4I0wWtecZqNSik9lbjpmBz60T+/P/pIfrzbT1DHrB9f4/KKH+WVSSIlhZP+XRhSHvn0 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: List-Subscribe: List-Unsubscribe: From: "Liam R. Howlett" Use a structure to pass along all the necessary information and counters involved in removing vmas from the mm_struct. Update vmi_ function names to vms_ to indicate the first argument type change. Signed-off-by: Liam R. Howlett Reviewed-by: Suren Baghdasaryan Reviewed-by: Lorenzo Stoakes --- mm/vma.c | 142 +++++++++++++++++++++++++++++-------------------------- mm/vma.h | 16 +++++++ 2 files changed, 91 insertions(+), 67 deletions(-) diff --git a/mm/vma.c b/mm/vma.c index da489063b2de..e1aee43a3dc4 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -80,6 +80,32 @@ static void init_multi_vma_prep(struct vma_prepare *vp, } +/* + * init_vma_munmap() - Initializer wrapper for vma_munmap_struct + * @vms: The vma munmap struct + * @vmi: The vma iterator + * @vma: The first vm_area_struct to munmap + * @start: The aligned start address to munmap + * @end: The aligned end address to munmap + * @uf: The userfaultfd list_head + * @unlock: Unlock after the operation. Only unlocked on success + */ +static inline void init_vma_munmap(struct vma_munmap_struct *vms, + struct vma_iterator *vmi, struct vm_area_struct *vma, + unsigned long start, unsigned long end, struct list_head *uf, + bool unlock) +{ + vms->vmi = vmi; + vms->vma = vma; + vms->mm = vma->vm_mm; + vms->start = start; + vms->end = end; + vms->unlock = unlock; + vms->uf = uf; + vms->vma_count = 0; + vms->nr_pages = vms->locked_vm = 0; +} + /* * Return true if we can merge this (vm_flags,anon_vma,file,vm_pgoff) * in front of (at a lower virtual address and file offset than) the vma. @@ -685,81 +711,62 @@ static inline void abort_munmap_vmas(struct ma_state *mas_detach) } /* - * vmi_complete_munmap_vmas() - Finish the munmap() operation - * @vmi: The vma iterator - * @vma: The first vma to be munmapped - * @mm: The mm struct - * @start: The start address - * @end: The end address - * @unlock: Unlock the mm or not - * @mas_detach: them maple state of the detached vma maple tree - * @locked_vm: The locked_vm count in the detached vmas + * vms_complete_munmap_vmas() - Finish the munmap() operation + * @vms: The vma munmap struct + * @mas_detach: The maple state of the detached vmas * - * This function updates the mm_struct, unmaps the region, frees the resources + * This updates the mm_struct, unmaps the region, frees the resources * used for the munmap() and may downgrade the lock - if requested. Everything * needed to be done once the vma maple tree is updated. */ -static void -vmi_complete_munmap_vmas(struct vma_iterator *vmi, struct vm_area_struct *vma, - struct mm_struct *mm, unsigned long start, unsigned long end, - bool unlock, struct ma_state *mas_detach, - unsigned long locked_vm) +static void vms_complete_munmap_vmas(struct vma_munmap_struct *vms, + struct ma_state *mas_detach) { struct vm_area_struct *prev, *next; - int count; + struct mm_struct *mm; - count = mas_detach->index + 1; - mm->map_count -= count; - mm->locked_vm -= locked_vm; - if (unlock) + mm = vms->mm; + mm->map_count -= vms->vma_count; + mm->locked_vm -= vms->locked_vm; + if (vms->unlock) mmap_write_downgrade(mm); - prev = vma_iter_prev_range(vmi); - next = vma_next(vmi); + prev = vma_iter_prev_range(vms->vmi); + next = vma_next(vms->vmi); if (next) - vma_iter_prev_range(vmi); + vma_iter_prev_range(vms->vmi); /* * We can free page tables without write-locking mmap_lock because VMAs * were isolated before we downgraded mmap_lock. */ mas_set(mas_detach, 1); - unmap_region(mm, mas_detach, vma, prev, next, start, end, count, - !unlock); + unmap_region(mm, mas_detach, vms->vma, prev, next, vms->start, vms->end, + vms->vma_count, !vms->unlock); /* Statistics and freeing VMAs */ mas_set(mas_detach, 0); remove_mt(mm, mas_detach); validate_mm(mm); - if (unlock) + if (vms->unlock) mmap_read_unlock(mm); __mt_destroy(mas_detach->tree); } /* - * vmi_gather_munmap_vmas() - Put all VMAs within a range into a maple tree + * vms_gather_munmap_vmas() - Put all VMAs within a range into a maple tree * for removal at a later date. Handles splitting first and last if necessary * and marking the vmas as isolated. * - * @vmi: The vma iterator - * @vma: The starting vm_area_struct - * @mm: The mm_struct - * @start: The aligned start address to munmap. - * @end: The aligned end address to munmap. - * @uf: The userfaultfd list_head + * @vms: The vma munmap struct * @mas_detach: The maple state tracking the detached tree - * @locked_vm: a pointer to store the VM_LOCKED pages count. * * Return: 0 on success */ -static int -vmi_gather_munmap_vmas(struct vma_iterator *vmi, struct vm_area_struct *vma, - struct mm_struct *mm, unsigned long start, - unsigned long end, struct list_head *uf, - struct ma_state *mas_detach, unsigned long *locked_vm) +static int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, + struct ma_state *mas_detach) { struct vm_area_struct *next = NULL; - int count = 0; int error = -ENOMEM; /* @@ -771,23 +778,24 @@ vmi_gather_munmap_vmas(struct vma_iterator *vmi, struct vm_area_struct *vma, */ /* Does it split the first one? */ - if (start > vma->vm_start) { + if (vms->start > vms->vma->vm_start) { /* * Make sure that map_count on return from munmap() will * not exceed its limit; but let map_count go just above * its limit temporarily, to help free resources as expected. */ - if (end < vma->vm_end && mm->map_count >= sysctl_max_map_count) + if (vms->end < vms->vma->vm_end && + vms->mm->map_count >= sysctl_max_map_count) goto map_count_exceeded; /* Don't bother splitting the VMA if we can't unmap it anyway */ - if (!can_modify_vma(vma)) { + if (!can_modify_vma(vms->vma)) { error = -EPERM; goto start_split_failed; } - error = __split_vma(vmi, vma, start, 1); + error = __split_vma(vms->vmi, vms->vma, vms->start, 1); if (error) goto start_split_failed; } @@ -796,7 +804,7 @@ vmi_gather_munmap_vmas(struct vma_iterator *vmi, struct vm_area_struct *vma, * Detach a range of VMAs from the mm. Using next as a temp variable as * it is always overwritten. */ - next = vma; + next = vms->vma; do { if (!can_modify_vma(next)) { error = -EPERM; @@ -804,22 +812,22 @@ vmi_gather_munmap_vmas(struct vma_iterator *vmi, struct vm_area_struct *vma, } /* Does it split the end? */ - if (next->vm_end > end) { - error = __split_vma(vmi, next, end, 0); + if (next->vm_end > vms->end) { + error = __split_vma(vms->vmi, next, vms->end, 0); if (error) goto end_split_failed; } vma_start_write(next); - mas_set(mas_detach, count++); + mas_set(mas_detach, vms->vma_count++); error = mas_store_gfp(mas_detach, next, GFP_KERNEL); if (error) goto munmap_gather_failed; vma_mark_detached(next, true); if (next->vm_flags & VM_LOCKED) - *locked_vm += vma_pages(next); + vms->locked_vm += vma_pages(next); - if (unlikely(uf)) { + if (unlikely(vms->uf)) { /* * If userfaultfd_unmap_prep returns an error the vmas * will remain split, but userland will get a @@ -829,16 +837,17 @@ vmi_gather_munmap_vmas(struct vma_iterator *vmi, struct vm_area_struct *vma, * split, despite we could. This is unlikely enough * failure that it's not worth optimizing it for. */ - error = userfaultfd_unmap_prep(next, start, end, uf); + error = userfaultfd_unmap_prep(next, vms->start, + vms->end, vms->uf); if (error) goto userfaultfd_error; } #ifdef CONFIG_DEBUG_VM_MAPLE_TREE - BUG_ON(next->vm_start < start); - BUG_ON(next->vm_start > end); + BUG_ON(next->vm_start < vms->start); + BUG_ON(next->vm_start > vms->end); #endif - } for_each_vma_range(*vmi, next, end); + } for_each_vma_range(*(vms->vmi), next, vms->end); #if defined(CONFIG_DEBUG_VM_MAPLE_TREE) /* Make sure no VMAs are about to be lost. */ @@ -847,27 +856,28 @@ vmi_gather_munmap_vmas(struct vma_iterator *vmi, struct vm_area_struct *vma, struct vm_area_struct *vma_mas, *vma_test; int test_count = 0; - vma_iter_set(vmi, start); + vma_iter_set(vms->vmi, vms->start); rcu_read_lock(); - vma_test = mas_find(&test, count - 1); - for_each_vma_range(*vmi, vma_mas, end) { + vma_test = mas_find(&test, vms->vma_count - 1); + for_each_vma_range(*(vms->vmi), vma_mas, vms->end) { BUG_ON(vma_mas != vma_test); test_count++; - vma_test = mas_next(&test, count - 1); + vma_test = mas_next(&test, vms->vma_count - 1); } rcu_read_unlock(); - BUG_ON(count != test_count); + BUG_ON(vms->vma_count != test_count); } #endif - while (vma_iter_addr(vmi) > start) - vma_iter_prev_range(vmi); + while (vma_iter_addr(vms->vmi) > vms->start) + vma_iter_prev_range(vms->vmi); return 0; userfaultfd_error: munmap_gather_failed: end_split_failed: +modify_vma_failed: abort_munmap_vmas(mas_detach); start_split_failed: map_count_exceeded: @@ -896,11 +906,11 @@ int do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, MA_STATE(mas_detach, &mt_detach, 0, 0); mt_init_flags(&mt_detach, vmi->mas.tree->ma_flags & MT_FLAGS_LOCK_MASK); mt_on_stack(mt_detach); + struct vma_munmap_struct vms; int error; - unsigned long locked_vm = 0; - error = vmi_gather_munmap_vmas(vmi, vma, mm, start, end, uf, - &mas_detach, &locked_vm); + init_vma_munmap(&vms, vmi, vma, start, end, uf, unlock); + error = vms_gather_munmap_vmas(&vms, &mas_detach); if (error) goto gather_failed; @@ -909,11 +919,9 @@ int do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, goto clear_tree_failed; /* Point of no return */ - vmi_complete_munmap_vmas(vmi, vma, mm, start, end, unlock, &mas_detach, - locked_vm); + vms_complete_munmap_vmas(&vms, &mas_detach); return 0; -modify_vma_failed: clear_tree_failed: abort_munmap_vmas(&mas_detach); gather_failed: diff --git a/mm/vma.h b/mm/vma.h index da31d0f62157..cb67acf59012 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -26,6 +26,22 @@ struct unlink_vma_file_batch { struct vm_area_struct *vmas[8]; }; +/* + * vma munmap operation + */ +struct vma_munmap_struct { + struct vma_iterator *vmi; + struct mm_struct *mm; + struct vm_area_struct *vma; /* The first vma to munmap */ + struct list_head *uf; /* Userfaultfd list_head */ + unsigned long start; /* Aligned start addr (inclusive) */ + unsigned long end; /* Aligned end addr (exclusive) */ + int vma_count; /* Number of vmas that will be removed */ + unsigned long nr_pages; /* Number of pages being removed */ + unsigned long locked_vm; /* Number of locked pages */ + bool unlock; /* Unlock after the munmap */ +}; + #ifdef CONFIG_DEBUG_VM_MAPLE_TREE void validate_mm(struct mm_struct *mm); #else