From patchwork Wed Jul 17 20:07:00 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: 13735744 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 D098CC3DA5D for ; Wed, 17 Jul 2024 20:08:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 844AE6B00A3; Wed, 17 Jul 2024 16:07:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F5A56B00A4; Wed, 17 Jul 2024 16:07:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 620646B00A5; Wed, 17 Jul 2024 16:07:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 31BA56B00A3 for ; Wed, 17 Jul 2024 16:07:55 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D9FA48181F for ; Wed, 17 Jul 2024 20:07:54 +0000 (UTC) X-FDA: 82350330468.21.28B7694 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf22.hostedemail.com (Postfix) with ESMTP id 7C23BC001D for ; Wed, 17 Jul 2024 20:07:51 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=OSGj4Mwa; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fdUqpcad; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf22.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1721246839; a=rsa-sha256; cv=pass; b=jc5RsYxr/ntqX1pvmeZoP9TRa17VibluTFoo5T1hSkDpWHbrO/Fr0uFRk4XiR3fkB1At4W YaWg/yJT4GE7wATIYGTlhJ2lWDhCisDzvQjxU49pqhEq3fgH4MjFzaXI1IKPb5Fgulp1t9 0/cYejhQ2Q5483JYjiL/U3F7wrENTbs= ARC-Authentication-Results: i=2; imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=OSGj4Mwa; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fdUqpcad; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf22.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.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=1721246839; 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=1TtzgtfAgfJoN12sNHXK3gwWMxm7+yNqFvSCP2hWL+g=; b=mOXilodieeCbE0NSSxSudc5/oUX5YIo4OeWL4U+68DM7ur2QZFdBN6fhodL+5183j4PiP+ Slf7w2v+fCkgqp97p1KuohQJGsJAeHYzK2VAGkUZ9qkv5ABLWPavroWrEv4ggsfLWVrOyb Psc8M+sGejc1ynF4Wsc7O956Gqx3LsU= Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46HJtuGd032011; Wed, 17 Jul 2024 20:07:43 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=1TtzgtfAgfJoN12sNHXK3gwWMxm7+yNqFvSCP2hWL+g=; b= OSGj4Mwa1q80GcM+cf44hAuyqlkPlz1Om4ioa9G7BRP0I0/OMdMOufli/Q11npva ym+nSBmySs0LJ4LTlLT8MYccsZfrUIfnTwnKPVN95iq3NiwvKTV7tJQ2PHvJBxAZ mbkPxtJQO6FSfEQqPkZoA3DRUorQtYG045nXjQfa/lWB+flfgHQs2YHqtlgfclqM OFTJ8u4iCwLoaaWfpVtxj4Y8t3lXkuYg++mLORNgQx8q5Jd893NNelJvZye+M16u eiKPy41iww/m1/sm83em1sJcgV/+eZdD/jfsOtbaVSYO+3DEPTEvwZ/huGE7vLC9 xgSRe3JHHS+r6VjouZzt+w== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40emhpr0qs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jul 2024 20:07:43 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 46HJ4sq7003630; Wed, 17 Jul 2024 20:07:42 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2040.outbound.protection.outlook.com [104.47.56.40]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40dweyhkja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jul 2024 20:07:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cgpkYaPVZntqAuUBzs/v08bb//fKwmyODrJa7wVsVnXNC10gSnJeYacakgCX13S+WuwZ8yHxnPG+lGIiZWCNKtahRaN6H6zTz2fehG3BGz3W5Lk8y2z6t9sdqHhG5OfYPaxDpJqC0nRvePcRC9bGOChYlkA2GqXt7AQSJqjCTXqlKE1CWqiReXeq0lXG6wp2D//Uc/SXEWReAUZsBjchwrxg1A2m5jUyWqMJaD/hKkjC/PRnbeonvhiNjM2umxnaUEveOzS9v9lk3s62qHTVhN7w9zn78xlsgX6SL1YdTPLW1u6QJu7SeOmyxYcMJP3opxB8xSuoigKKhgOjENY3tA== 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=1TtzgtfAgfJoN12sNHXK3gwWMxm7+yNqFvSCP2hWL+g=; b=sKA+Ilgl+KapwzyXeJzC+bckBGNM2bDOrKJDbQp41v30wdGuKIconvU4Yewv+ZY6n4Do3tXj5lCVRjs+hDur4GNAsxJ4R6hRetKdNJE4J6TSiCeKAyi8FG7/uj4QE89qGaI4F05fGRKbDB6d8FkTkrrNErTwixVmS4+9dulTcewgKMlIyb69FqRPHPQVNyDE90rJezjc3WYnF//PoP0tyY3wE/wnZ01g0aJs8eJDrJdmmvJeyHuw4OjGiJ2COIpL2hbE0dTd7hshZ51suuMCtlKtjoCHTLzWFN2+YFfyp0OyNNEHdxo7oEIgPgN/8RzLHXUwicBcCpgxJfWw459Nmg== 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=1TtzgtfAgfJoN12sNHXK3gwWMxm7+yNqFvSCP2hWL+g=; b=fdUqpcadriZAmrLMjmdvgl9+aqRzWlqs173uGR7Pm4TZq/en9uJXBY2zoe/XDIwZ3i0LHhvzbR2bzgZWvwHETI6qFREwv5z2ySPN14ZvTUJKdF71L3/cPorMTY9rm4mGRDVIZmkVCiINpn6ZuUwNcKH7P4ZVVMU4ntTUSO6T5mM= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by DM4PR10MB7507.namprd10.prod.outlook.com (2603:10b6:8:187::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.16; Wed, 17 Jul 2024 20:07:40 +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.7784.016; Wed, 17 Jul 2024 20:07:40 +0000 From: "Liam R. Howlett" To: linux-mm@kvack.org, Andrew Morton Cc: Suren Baghdasaryan , Vlastimil Babka , Lorenzo Stoakes , Matthew Wilcox , sidhartha.kumar@oracle.com, "Paul E . McKenney" , Bert Karwatzki , Jiri Olsa , linux-kernel@vger.kernel.org, Kees Cook , Jeff Xu , "Liam R. Howlett" , Lorenzo Stoakes Subject: [PATCH v5 12/21] mm/mmap: Track start and end of munmap in vma_munmap_struct Date: Wed, 17 Jul 2024 16:07:00 -0400 Message-ID: <20240717200709.1552558-13-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240717200709.1552558-1-Liam.Howlett@oracle.com> References: <20240717200709.1552558-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT1PR01CA0101.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:2c::10) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|DM4PR10MB7507:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f2497ce-a893-453e-879d-08dca69c1c5c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: LSd0jL+q0u2kUs6RAOByPRGWWSeP0S8mnk9INejQ0SXIj1xrmQF+Lsh+ZtyqabRkKb4iGuZi18SKqgp1C3xS7/uc4Z2lT4CWZd775n0k99ODvLw0APuOpPZnAGpvJJK2V569SepWQTVMuo7nCDpgr/i3xFCrZS8HqkE07hKtgIeq7hg9BauELBq2c6qr28zGn6rF6zvSQmRFJ+Myj7A7sc9eFea8yAykI7ivnoyiQZIFLhnzQ82r93viLvplM4yclT46KXT4Z2wCfwVD7mVhiJi+keYK6O2YsipSjuoyUol4ZkuIvV50QlZ2mkSCTGDmSNBJJ3pkJgVkbfsDvjrQ8q4QIM/tWgu9re8zy8jhCB8eBoZldnFdRwbOBX2VjorAZfuv0hAgdRLr5s86Vw+76UHC/dg+JZCgtRzUID13yeLCcvis1JsnGzxVhfZOWQQnT43Lpmg8JdPOIKBSM2QRJdJeyU9fg2PKusWWc5lORRmCc/2MboqeHkT91qUSE9UxnPbGw9hDrIlzrKfpjZHLYn9ybD1mGbvxA/346D4ZiYZaydERsr4U9aZjDqwdaf1OG8nObAB9Nm1dAI6D3QP933sYhblTTlEVzGzZb+0Hj3z825mZbQ3OM/v4oObo4YuUHvKdepLpy9TrqqUIjgrHUU551nWd2u3QGkoR5wt5aQy8NgSw9Z1sktXdA4BMBS9uxv/OQPZB7H6cGN6mFqjUblFdraNwkvrMIfHIefDbPYEKXP9vxKzVhKnG41sizCsdYX3w74yYPvA/1YQRM1PN7JsAigl9uOLb0h5tGjR1ZJqUYQBZwB0RnOruKg/1H0TNCWlk8A8dxgUc1kCftPk9vnm5jyXNwnIfz0wak/8081ZAoeOwZW+0Lia6odTPFYtreBQBqwShp3qSXQtJNZ+j+0jCYU1Hsay462gRH3ZDoQiplEHVu/PgRFH/G5dMVXs+apdqywsHIDor4H0gct1Q1o/V4zGKkzd1/ZUdG6+nBVZCo2eSgr/qb31RJ6NAa+QJxBNzHeIuxyEDYu+QYvuEA7O34JacFQMzTWVIF16hbrRo97UZ0a1zcUBDKEOkicJGIGtPOlD0Zk0KGIyXqgS1wDZY7n88qVn/qC46kBkOwH9Qu+C3qVJwetYBeMWgh1DCR+OXGn49rG9g38ZRTM76LwuMZ/otdYV+gQ3gRoDhJk84jIyFIgNn4SZZach4wS2STPD9FqJK0lcQwhYQsJPuqgLxC5T61vVDGpcnWMNXxtz4DgAqDKbjQvt2GJndEgoPo3MQRwZ7IQokgWADr2xb5u+rnQWNKBYQImmQb9xZBrDskkl8JV8aN7H9PlmHGph8fO3ZooM17RsIvUy9ueWBLA== 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)(7416014)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3X8GE6puGwoEYmhJQk2OdM0P5mWK4EhjGWlxnNodHk3hVTscJnGkDQvqPWlNapl0W+3OyTeIe/VjB16Wra5q2s8WK5W1EYPHG80mk+KpD5Mn4yW5r64Vuimn0creO/SX/gRFl2Q5buBQr/wcWp9Lf2F5nPvS2C581f0Iv2Lj01jqWsHTDDqj7Vqbealkqsve+bg6iJ4Z/E2lxcg9lkcimOGBqafEYZxZCYPnV9Akp/rDvTx7wNTS+EHu91xjVA+QeM/M3lTHADb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Jvh9CHAFJZX4tWvlvV8dVDcQcLNyVAfbLWTXWAvjOYW6oaOANtrjm3wwIWNyv3vKSIHbO9jXRxn4bHJCwiwurImQeq4OvQQvPeKZPgz18HRRFBrh9tA9UI1htXyQh7Sstr9XOEsS9esDyuKlhtANP232CNs9h6ycANyC9twQkeNb/pPyjq1ekGoC8jMS5E2oer5gBK5t0s7SsLHpZ+/rB1t5VIF9wny7FqpFE8dJNIgdi1r9whyfwRCGyBfCnavO/GBMM6STGqulcCtoPA7vfR3WFADcPoxKw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: UZyXF+2HwiIG2cbnKvil0FqC2tBYlSNg0gVqf6HG/g+WbWTlxSqh9LA+aJFiU5AWcKvXiiRBoVPhiz9tCETQEaoP0VErcFpQt7SL0zP+iTZTKENJJYRET1eGq49EDa1c5noRHM8MJp6NYaj7itXYxA1y6iQEKjwSNHelLiL2dSZjCg9VeeWsFYS/91YdUSnt2H2UH/iVbBdspdnImsWHUMzjnN2izDJy5QUPddS+Ob7uz1fNOAy7d48yE4tLwVhZjNMzv3VNR55bWSdfnYoNmpMR6LTHcIwevXeob11v3hzdvlICYZtzF1iSjRhk1cwUcEeT2rkdw6UHk8JlIKuEFVxNc3r9ooK7x9MfFUuIxpROA53zjr4JucMDVmPmCNHHhOtuRtfLlW3TBDp0Yzvpv0qDplEQVGOInotaJgrrwhZKb4yg/5kUxhmZCbLeNPjA5klfGkjPecojJNO668GW3bXXSwHtG70PhBRrmUR+E7WoGrsysxTaLhZTgbJp4n8v6dYODee2glurJprBZTUvKUadlf5JwipMCwUbn7h+0U+rPRIzxpvTLTE23cTwJMen5mDRdr23NhmMSyIn3jQcfJTodgefdOfayYbdBNS1+J8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f2497ce-a893-453e-879d-08dca69c1c5c X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2024 20:07:40.1834 (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: pbUt0/S0Ri2UMXBjMQ0xqcUQP6XjR8Pwu6uXOYTxaYYgwKWwP0l/TiYXWoz2ggJ7N+DDd+FFqd0I2PkkK1k8LQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB7507 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-07-17_15,2024-07-17_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2407170152 X-Proofpoint-GUID: I_zVh1YjHHwW-IVez-UO1U83I_cf5lFO X-Proofpoint-ORIG-GUID: I_zVh1YjHHwW-IVez-UO1U83I_cf5lFO X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7C23BC001D X-Stat-Signature: xezwckzz9cgg5psn8uyb455um8mhgh55 X-Rspam-User: X-HE-Tag: 1721246871-875770 X-HE-Meta: U2FsdGVkX192bK4kx2KBqaJxU8Vt3zvWFo3+McEPeVdVxcOqldByJQRjhkw2Fn/pfZdzfq6MHT6t4ihIt3iWMOkXaVXu1YFFOvKzEB1sjefDAVtc+mw19rpIciSEA1LCDVoVgDkpA08Qkx5V86eytCQt0TeurYgpZxxMhB2wr67xBw80fVrURFdXp6RXbNqGfobtsmTr5LWsDUWJZCcHcY4DfFOMgkbDuCgLQpwn/oC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LdbR3ta8SkuHRyZYjpcFShL6fklhsPcBC7VRU2J4d/fLiycs0AEurgUiHs3WGkIwc3Yo28qrKxEon3PoD+GfJRzHMfZmCCuyAP0WsrLXIhW3m73SSG6iRWofFZqJfIlRgybWVWvQeDqMVEjZ5RTXdeA7h4uqTIclKPf72Xkl4YfP/r+omp7/yfyKFQDcZcWIrcWVjbWmFzosXLjhbrrSIkBgxcRQ== 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" Set the start and end address for munmap when the prev and next are gathered. This is needed to avoid incorrect addresses being used during the vms_complete_munmap_vmas() function if the prev/next vma are expanded. Add a new helper vms_complete_pte_clear(), which is needed later and will avoid growing the argument list to unmap_region() beyond the 9 it already has. Signed-off-by: Liam R. Howlett Reviewed-by: Lorenzo Stoakes --- mm/internal.h | 2 ++ mm/mmap.c | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 02627e269d6b..ec8441362c28 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1493,6 +1493,8 @@ struct vma_munmap_struct { struct list_head *uf; /* Userfaultfd list_head */ unsigned long start; /* Aligned start addr (inclusive) */ unsigned long end; /* Aligned end addr (exclusive) */ + unsigned long unmap_start; /* Unmap PTE start */ + unsigned long unmap_end; /* Unmap PTE end */ 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 */ diff --git a/mm/mmap.c b/mm/mmap.c index b940de8c6df8..7cc1f47122f6 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -530,6 +530,8 @@ static inline void init_vma_munmap(struct vma_munmap_struct *vms, vms->vma_count = 0; vms->nr_pages = vms->locked_vm = vms->nr_accounted = 0; vms->exec_vm = vms->stack_vm = vms->data_vm = 0; + vms->unmap_start = FIRST_USER_ADDRESS; + vms->unmap_end = USER_PGTABLES_CEILING; } /* @@ -2612,6 +2614,29 @@ static inline void abort_munmap_vmas(struct ma_state *mas_detach) __mt_destroy(mas_detach->tree); } + +static void vms_complete_pte_clear(struct vma_munmap_struct *vms, + struct ma_state *mas_detach, bool mm_wr_locked) +{ + struct mmu_gather tlb; + + /* + * We can free page tables without write-locking mmap_lock because VMAs + * were isolated before we downgraded mmap_lock. + */ + mas_set(mas_detach, 1); + lru_add_drain(); + tlb_gather_mmu(&tlb, vms->mm); + update_hiwater_rss(vms->mm); + unmap_vmas(&tlb, mas_detach, vms->vma, vms->start, vms->end, + vms->vma_count, mm_wr_locked); + mas_set(mas_detach, 1); + /* start and end may be different if there is no prev or next vma. */ + free_pgtables(&tlb, mas_detach, vms->vma, vms->unmap_start, + vms->unmap_end, mm_wr_locked); + tlb_finish_mmu(&tlb); +} + /* * vms_complete_munmap_vmas() - Finish the munmap() operation * @vms: The vma munmap struct @@ -2633,13 +2658,7 @@ static void vms_complete_munmap_vmas(struct vma_munmap_struct *vms, if (vms->unlock) mmap_write_downgrade(mm); - /* - * 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, vms->vma, vms->prev, vms->next, - vms->start, vms->end, vms->vma_count, !vms->unlock); + vms_complete_pte_clear(vms, mas_detach, !vms->unlock); /* Update high watermark before we lower total_vm */ update_hiwater_vm(mm); /* Stat accounting */ @@ -2701,6 +2720,8 @@ static int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, goto start_split_failed; } vms->prev = vma_prev(vms->vmi); + if (vms->prev) + vms->unmap_start = vms->prev->vm_end; /* * Detach a range of VMAs from the mm. Using next as a temp variable as @@ -2763,6 +2784,8 @@ static int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, } vms->next = vma_next(vms->vmi); + if (vms->next) + vms->unmap_end = vms->next->vm_start; #if defined(CONFIG_DEBUG_VM_MAPLE_TREE) /* Make sure no VMAs are about to be lost. */