From patchwork Tue Aug 20 23:57:12 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: 13770663 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 6CC0EC5320E for ; Tue, 20 Aug 2024 23:58:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BFD556B0089; Tue, 20 Aug 2024 19:58:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B86D96B008C; Tue, 20 Aug 2024 19:58:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9143D6B008A; Tue, 20 Aug 2024 19:58:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 671AD6B0088 for ; Tue, 20 Aug 2024 19:58:08 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 152B71C328F for ; Tue, 20 Aug 2024 23:58:08 +0000 (UTC) X-FDA: 82474289856.19.BE87B52 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf14.hostedemail.com (Postfix) with ESMTP id B38FE100013 for ; Tue, 20 Aug 2024 23:58:04 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=iV48l5rF; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=GrdPLvtr; spf=pass (imf14.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724198245; a=rsa-sha256; cv=pass; b=UfHCOVIIVzxNbMs1tcYjXCXofcMW4lTGuNol0qxY+VkUUY5ynwoKU5X3Ot8kKR8PQSfd5Z Pz4+zBKttJooeC4BzuIXgjjbV4b+xyFl4ZUNywIeVX/G0csJlODAKQ9OipkXje1EK8vZsI LcilRWdh8u23MTYpPPuwunoIi3xzhVY= ARC-Authentication-Results: i=2; imf14.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=iV48l5rF; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=GrdPLvtr; spf=pass (imf14.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724198245; 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=INR2A1cBDUV4GAxtVOjXNUJPR3TPHjuX5sIyohpW8AI=; b=g8sPpJ02TZA2x/OLGwITVl95mEu0CP0Rikb4TDFJqgQiAcBQR/X6axFkvgIjWGW/7nyAnM ByiySIW9EaHh9mdunowAB2tn8wdMP6E4elt/PAFr6NwNmWZG1NAzWkbcANkkbsczyyjzbD 4WU1ZYRxuhXQcY1wk4W8wdN6chYETaA= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47KMBZAm028778; Tue, 20 Aug 2024 23:57:58 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=INR2A1cBDUV4GAxtVOjXNUJPR3TPHjuX5sIyohpW8AI=; b= iV48l5rF4ocf/bbzCROLPZ7nyNuMPhodD62nvz3mNwW/pYFo3WmHEE+5Szy26hJK PH//eyeAz+cvW9iBl23R9X4ih3st9XSzIDyQm86VSsY5N1C9U35vF2srZOq2heIe 66KlaspkivKwLPw9DvPthGNvhB+t8NElRAsA+VBJD+ttVlP1Nbadmkr0cnEJmr+F 1+v11L/TzpTcrcxUHUT578WpYUpkodPAxVyZDYMHR8BWUhETdvHt6BU3MZFaOLyp oVSxhLP2BIZfght5Sw1qWdULzh40YaWKb9JIk9EnOv7x47eGRhgcrwrTrrK+CyC1 GesgvPHNW7XBk6k3fON/gw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m45ebss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2024 23:57:57 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47KNY6L9023532; Tue, 20 Aug 2024 23:57:56 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2171.outbound.protection.outlook.com [104.47.58.171]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4154x78fsn-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Aug 2024 23:57:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ump5vfYfdkDXcf4qIMy/ALfyhD0pVgIXwMc2AvHS6wqwCC5Ai/7YKOwC3K8HFZLiMFBGaFyPE62zsPpaYjq8awsneVnV8mHTTc7kgrcW7RPMu2ttRTWT/zTnGTpiVarTocgU0Y0T0HhQKg5/AsmVVrzQK5vhK9Mj7CWoZiZB8ujewE4uvtt/oED4+asmpzLF3T4WRp/WCRJnG6cmedu6Wwbv2RMteap8Oq/y0q9i+/crRV9SWWCrLqtHF9Noe802CNlLFQubIB7L4l8RPchOLsjDXlNRIHuqQeNREJi6B7a3kinlFvHI6/oCee3FwPH7gSgQRjxaJuM22f7LN6DpFw== 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=INR2A1cBDUV4GAxtVOjXNUJPR3TPHjuX5sIyohpW8AI=; b=oQNFFNk/HLFr5a75IqEaY8jHxebgG6EDNAoeo63IlErCY/2pjUfzgDqfWl9pCK1rtwZbtUzm3Yq5bOYzH7a9FzMivScRUOy05Kr/ilY6vSWl95JSkRnU9nL48xzUNQdJ/WLgpFa1OGLKQtG5wWAt0GwHpAJjZd2mw24lVn+KVL7/ftM/reOMB688S4SKoQM5vMwA2/pQkGi+8bGiODwm9ATa2xwaDzExYHrOg6uJ6tGO+mS6EtVs2RJ4i9jvuc+Yw36oEurCZKV/JQgxUmWFSOG0h+pFp2AfEpLLuMiVQt035qmUolzzn2GBA2KG7wo6UH7jCWFbJSCzAEbegrvopw== 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=INR2A1cBDUV4GAxtVOjXNUJPR3TPHjuX5sIyohpW8AI=; b=GrdPLvtrG+ipjAWOxzcActXC4g/mSfsOL9ye3jHGCN57aX7+7uGOdfSK/u8A/QNDzAG39fDtmUaDQJJKvk8Zhsj0RY/a6ylPnQ6DG3Fsgagvdhqcvt8alIIf6i9psr7jZp54z4TcbRBXPWbO51uSsZoGPB6nBtXEk4OKclVwwuc= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by PH0PR10MB7099.namprd10.prod.outlook.com (2603:10b6:510:26d::6) 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:53 +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:53 +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 03/20] mm/vma: Introduce vmi_complete_munmap_vmas() Date: Tue, 20 Aug 2024 19:57:12 -0400 Message-ID: <20240820235730.2852400-4-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: YT4PR01CA0123.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:d5::26) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|PH0PR10MB7099:EE_ X-MS-Office365-Filtering-Correlation-Id: 7145c791-b2d3-4962-d81c-08dcc173e7b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: jbU8J7LBKR3gauWRkSXEzvbVpOluRb5OmDqVqYtyCKiZJC3KbPXz9NKZYQ+j8USolP+TpUJN4Nlfq+FhfmlrJ5bvyvAWDRsIPEkrQWr1Bb7hmz9dJBtRfSUs7XJ1ie0gdpPcSTDHWxokJXPATiC84H2SaIkJbIHUMWgTCkIp2x5SPuNdVOUpE7IpbTRlzYKTexx8VsseoNLmo4Z+1tZJ4gkQQpULA0tqQmk2bUUOafKUOndrQXn91RkT0pM9kb7BTZFPKJMfddureN/4r+QriJD6EifzdwbnDZBC6skQa4YEkCnu/vNyLwhroanROnXabdO9rJVY2W3WJTDfcQmoQ0JPUwZyyt0Mldogpa/XPjz/+y9QfxW9Ur8wvr8TnZ4+9EDpYzOu6isBN4a7JqKEB9KtRdjNe2Hj1/BkbDpTXPMDVt/mu/K0679b39FAWQR9xfPF0YIwDaiy4fAXhlbgjltVYTusjqINtb7T1bOaAmOaUzG3dJvA0yqc768kTB/M9Hq6QVum06hQAlz0SQTykfYBbNE1XSJIqZrjiFzFRT3hpcw6RmZj1eMSv1N+cbj7hQYEAxn1BYlU3x4Hq7guREiFa7UIbCj6V6WqP1iSSmKHER1ga15P39pLR2lg5sZrGj66VcJKfFqbYz1ZMzf4+JAtJvV69hk9tw4exOoZyj6EV270q3Yr8QLTPmV4O1U9JAat8ajrlm9sxg5ZCJLArKOL9Xh6AlC0c+tweN9IenWRT5TDRQYaTyv4y/XsyS4Gl3JBUZClQLuW+ppBstertDsCxOEW1P0CQiTSa0BNtd4hDoCZUwT57Jmq2xEmJGTFFSFaOqa4ZM8K/HJVrhwuNG4eb6Td3w4ECfxfzJDtfc3ahcnzm76hBnBSRx9u7cCtqS6HaFBkQaAeOAYrkC1irGzLQLR2llzj0Y7cwJ9VJvaxk6bT3Yi0ec9G5TLy7IFpCywMKgb//9RJpjfT3ycf9hRLeCuro3Q7rpVLy0u33gjqu8uk+C/pgUf20SV2iloP/pgoSsnumC/yA4xG7pLmdGaGMePdcoXGzGwnuW3ctmFlbnkxlW2XogyxH/6M4EFW6+Udmans260c+zpXb3hU0Of4ovR5o8N1OMVHru91i/d9dzt7krE4oJcHRRtsu5J0FGrZZcm7F+VdC6ahZLNwOm3gCwWO8NdzmUrQNSjTeqTapwADFp5ymZbbF4N6XyPwLdxl0kNCwxGRrTAGk5jORkp8oQqpEa4bQ4dDeimh8nNU+rzk89INkvIHX4bBi7n5hA+Coi6lIBjrUaswikl+rNal2PnVbnGKEn5C8z5aH+6+g6URLZtRv5W86xmTHA66gY6Tf84ExsGfylAAXyCA7g== 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)(366016)(1800799024)(7416014)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EPI0OwAMW3Ogml7X6pPxJF/0X4QpGC3FN+drUZwhGF596Rgxjkvst/E7FPRGwxM9Oav/uMclm1FtKgd+XEWsU7lM7IFdLJ5DQF5q454NqIEDMQQypFstQo0VfMXLPl684Yv7/pQeS+0iXT0yv3dBH4T8HPta0m09TFaVc8Qx7q5b7v0hVqu8NYqwFR18ghLDJC1ZsEZ/GFjqXvM3/nSq6PosfYQ2nZPQmIIlWWMD0GdRBiTNFklH5Vbnlpi8gFQrwU84s+B9VAX4HjJbS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AbYgUEcZcopEnOsh/QNuT7pkc6hMaj5S8Gf1eYys5HXT4d4KZwD+m3O9GdBVc6zdDu4npNTKoiC8tH19qcm79989STwXyCBvGG6NLrYUOwBjOnJrgLNoUf7TivwjFxps7+vOD/wGY9wuxIRRGn1mbYEH+j5MitPFKq39Tla5DGTHSYJPD9Msnb1yul+FlFXa4SV2qpfMQIy2hjN9gk82QgSf38FzzH4ejZoRLpsCb+XV7/rsILVEf6BLs X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: mzs3+hbdvRKZIctF3TsKLwGghy4KiycNr6FODrGhIu9IOIrfKz1decLajuLbfZ5DrTNDIzbwFhooS0fL9quYlq4PLlcjPeUZHkG6JRLuvMYydN3bo1KIM89O8For4IHw26a0aPbpMlnjw2Z6nDsfS0DAGOwO6+1pc1CSNDWDbPcVT53tCFtdPY+X3ClR9ImQLdQ4YD7gPXA9UbOLllb35mphvCHCtsUNLhngbudS0vvugoHCsgbMkTwcx49jiSS0bnbbiirQavLzFEiVG+J/YnrN45C7uFe0eggRInOyvcZMB1Y7vsfCao/xEyUijujj95J5oOqB6rgKHQYI1F/eR9kswGkvSjBg5KXTVof4YdXtAkFsgHaeV+GrJ/AQAE8KZI0P0CqGoUP5Oxu0LQygqI4D5oF+V0nTBiYjBtRC0dXiucLB2YVdrC5RV5Ui9ficpae3Gvv3l92wKaKY+bNJHWqleDGa4dpd7vzF7DgioT7Ag//o6oiDenQjAhPL+uJwgITWHWZDemEvDRxnuGlJdcO8yrxKnTXpMmpiR3Y3xEjyi16877yX5cSXdvvykL49u9Bb0itmwYQLSg+/p7eCMrbspf1ipm+6OUUGh7pN3i0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7145c791-b2d3-4962-d81c-08dcc173e7b4 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:53.4433 (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: 5yfTxP7nc2sD0lpKARLqB+Z1ul0HcTEgQGs/QII3vRBWgCULbzcdLshg5vMbpFanU5pWcls0VWD5Lprmq+LMcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB7099 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 mlxscore=0 phishscore=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408200176 X-Proofpoint-ORIG-GUID: TKAvJgV6Tw5tr_8J_E7flWznTOJ0muVd X-Proofpoint-GUID: TKAvJgV6Tw5tr_8J_E7flWznTOJ0muVd X-Stat-Signature: 551jx5wubp9617i353w6r1fstqnjhzii X-Rspamd-Queue-Id: B38FE100013 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724198284-346183 X-HE-Meta: U2FsdGVkX1+k6zt5jHgfGz6SFK+ydqksQ1n8OEUWi/d9TGc6EjCZNu1YKUCol5BBfFL8D8SLe14gtD+zkPIRcpvU6QQrBB9vAacQ12Ys8TDQgy+eXvAlssXWe9m1qzeek6e2dambhBfJ+rooUCPzX5vBRqoSPVi+v80vpBZ+KqEGMlRpdSklLl0RfRA3DtZiEPoD2vuIbtKueT81I/p+P2jB0H59GHhnwxE6RpDPnDmPECYey+hp+vGgh9nQQ4PgHRgsjdtC32cZvQO1suwlB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MtT5bks+LUGCp4ExEtMnRYE8+PzBUh9KFaiZMAndBqefrQ7HCnsUK9HNUU0T3LyLdFJvwndfUs2WcZ4HTMELKwquQudt2aLOE2jmj+Y/msYnlajEwy/Xdp4uK/2Qsk0GKGt/W23byFQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, 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" Extract all necessary operations that need to be completed after the vma maple tree is updated from a munmap() operation. Extracting this makes the later patch in the series easier to understand. Signed-off-by: Liam R. Howlett Reviewed-by: Lorenzo Stoakes Reviewed-by: Suren Baghdasaryan --- mm/vma.c | 80 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 25 deletions(-) diff --git a/mm/vma.c b/mm/vma.c index 58ecd447670d..3a2098464b8f 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -684,6 +684,58 @@ static inline void abort_munmap_vmas(struct ma_state *mas_detach) __mt_destroy(mas_detach->tree); } +/* + * 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 + * + * This function 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) +{ + struct vm_area_struct *prev, *next; + int count; + + count = mas_detach->index + 1; + mm->map_count -= count; + mm->locked_vm -= locked_vm; + if (unlock) + mmap_write_downgrade(mm); + + prev = vma_iter_prev_range(vmi); + next = vma_next(vmi); + if (next) + vma_iter_prev_range(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); + /* Statistics and freeing VMAs */ + mas_set(mas_detach, 0); + remove_mt(mm, mas_detach); + validate_mm(mm); + if (unlock) + mmap_read_unlock(mm); + + __mt_destroy(mas_detach->tree); +} + /* * do_vmi_align_munmap() - munmap the aligned region from @start to @end. * @vmi: The vma iterator @@ -703,7 +755,7 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, struct mm_struct *mm, unsigned long start, unsigned long end, struct list_head *uf, bool unlock) { - struct vm_area_struct *prev, *next = NULL; + struct vm_area_struct *next = NULL; struct maple_tree mt_detach; int count = 0; int error = -ENOMEM; @@ -818,31 +870,9 @@ do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, goto clear_tree_failed; /* Point of no return */ - mm->locked_vm -= locked_vm; - mm->map_count -= count; - if (unlock) - mmap_write_downgrade(mm); - - prev = vma_iter_prev_range(vmi); - next = vma_next(vmi); - if (next) - vma_iter_prev_range(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); - /* Statistics and freeing VMAs */ - mas_set(&mas_detach, 0); - remove_mt(mm, &mas_detach); - validate_mm(mm); - if (unlock) - mmap_read_unlock(mm); + vmi_complete_munmap_vmas(vmi, vma, mm, start, end, unlock, &mas_detach, + locked_vm); - __mt_destroy(&mt_detach); return 0; modify_vma_failed: