From patchwork Thu Aug 22 19:25:28 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: 13774127 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 0D0D3C3DA4A for ; Thu, 22 Aug 2024 19:27:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7A1608005C; Thu, 22 Aug 2024 15:27:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74F788005A; Thu, 22 Aug 2024 15:27:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 556268005C; Thu, 22 Aug 2024 15:27:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 304C48005A for ; Thu, 22 Aug 2024 15:27:07 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id DB2D2A048B for ; Thu, 22 Aug 2024 19:27:06 +0000 (UTC) X-FDA: 82480864452.15.C338B65 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf08.hostedemail.com (Postfix) with ESMTP id 9910316000E for ; Thu, 22 Aug 2024 19:27:03 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="UyjSsk/4"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=K69pW+Tu; spf=pass (imf08.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724354806; 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=Nm50G8hesDrXLpOFDcpgh9FovxUYHbMgImgPa3a7NFw=; b=K900EY0YUu4XQTYFJUJ0fNk0yuc9rE0gXdOZwPCYJ7FS0TRdwJggebdJgIJzEv7IeS5rJd lySe9LL49YuZwBV8k6yFmM8FwZQEtRAVuv5Hv3CGtolSmK0PBNPyizHNBSyCqy9ZMnBttG 2pU4ndiH7V8SAZypalQ7ZGE1Nswb7Kk= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="UyjSsk/4"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=K69pW+Tu; spf=pass (imf08.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724354806; a=rsa-sha256; cv=pass; b=uWVoWjZqPHq9uPHuW/COtWt8d0IO6sLc15IgziADHxpGSFB1onl9R/LHKHKZvfpK2Pbgs0 bBFkWGfKCbRizkeLEYZZkqb0tYIXfuiXCtDGKRGxqpCbakL1fl3Gd5XJLBa7xPZGxRS8LU gCuJY5NP5qgaZ9WdVnngl3y4597RjCY= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47MIMZnR025771; Thu, 22 Aug 2024 19:26:55 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=Nm50G8hesDrXLpOFDcpgh9FovxUYHbMgImgPa3a7NFw=; b= UyjSsk/4Vm4KBnSht8mONiqj2lqkFq1xaWYS8zUJ5P9YtW83Sdvyr7H/0pDQGReT UC7G7qLIGRaN66OlG8TeTM977G+EuVPr3xiqLVOEXgHA0GCrUeRuOP/XCZ64zh0K I0AmA4+UL9IRWHbdLwXenW3tuLUs5EFd5Xy9zwNtHAS4ZUkURsOzs0XVHmaO+I1m Pm/pjcDjSVuQNCS2bYtlK+x5bJXQSzawA+9TYyr2rGtrC1/Itr5ReJXJJlvrl3eU COLEh+9L7GVoSphojlwkDX/zxjpKmzhgOMM6ad6gKzZ3hlmihZoWuduiRnpmvf81 inYXqxAGA78J2zhEZxBwTA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m2djxyg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Aug 2024 19:26:54 +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 47MJJK8d005374; Thu, 22 Aug 2024 19:26:54 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2040.outbound.protection.outlook.com [104.47.57.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 416bcu08ec-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Aug 2024 19:26:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vQG01Df1ldRuGNyZ1elBjHO4rHyxYP8tfkgmUNFLj+ZAiAX25pNR4mkWmqRNiUfZ7i3EEcfSVjOZucEDPSd0ZaE6+ixcy9eCMHcLKt8JjUeeJ4LsPIhDaN8xuabHr5+vlNgx54cdyhVOo4atf6d30/xLNgLg907A1RpVKQyk6izdUMrAZU3QqZmgdT9cfnd06ZCcnSLQhyaCN7ojMtiJ0Reot/tzVN5XlYXbpb7Gi7dOsq2jH8aSCSEbqbcqK0DuKh3giTZPhYvGzWSpfFT6nf846Kty6WfsIJcREPXS+Q43P81LHuKp1CzvjRmkHdaTz1LSm5tBu5UEGo2eCbM4qA== 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=Nm50G8hesDrXLpOFDcpgh9FovxUYHbMgImgPa3a7NFw=; b=IGBgowwmZP3cwOVsGHIFjSpi2Uf79Yc8n6uRvL2w3rzniNInIquAd5NWK5eroNhX1MT6hNRC4fvmQrE6w/K8FnaL8xPjwXKbivMr8XCOhDN9eAwVTUpA7gmo1haalb42TY57vtc2xCRjn2/Juxke0Ntsp6GSOjVUmE6wGTaPIPBFmQ0i+jT69UUXadxzMh6FFSCEX8JvgYnErz+msT5KGnNzT2RqQimZRgHkZbryz5szdwgLBfwqZMk1fkf5FN138GpOx1jz8Cc4CS54iWwu18/yKTeQZ+n+FcTWf8dG35ueAXirQy788aiNo6mcw8Jev/3uNXkPuF6Zy3UA9lPBXQ== 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=Nm50G8hesDrXLpOFDcpgh9FovxUYHbMgImgPa3a7NFw=; b=K69pW+TuHnznUN3yZKKIJzqpF2BjKZTyzIiEqkKqDhm6uIek/QIdM5+2aNObd5tdfXws21gAn2KxxP8ova5yMS/SmaKEnIguo3WMpaWFbHFTCGVWm6z9xqPedaMI3UPoy1zQyyzCJg9gUe8SObLF2MqybD+MIPCO68RW7ZEchI0= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by PH0PR10MB5729.namprd10.prod.outlook.com (2603:10b6:510:146::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.13; Thu, 22 Aug 2024 19:26:21 +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.014; Thu, 22 Aug 2024 19:26:21 +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 v7 06/21] mm/vma: Change munmap to use vma_munmap_struct() for accounting and surrounding vmas Date: Thu, 22 Aug 2024 15:25:28 -0400 Message-ID: <20240822192543.3359552-7-Liam.Howlett@oracle.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240822192543.3359552-1-Liam.Howlett@oracle.com> References: <20240822192543.3359552-1-Liam.Howlett@oracle.com> X-ClientProxiedBy: YT4P288CA0046.CANP288.PROD.OUTLOOK.COM (2603:10b6:b01:d3::28) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|PH0PR10MB5729:EE_ X-MS-Office365-Filtering-Correlation-Id: 780c3f00-8115-4fe9-a8b0-08dcc2e04d61 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: FQUYcPTr3YHZlMRzt8rrfylU1s5o0vLUPKx7RzvHSXQ/TBXtM1u8qek6qNqfUiJGne0RJqrPnOewzSc/eruZ352wXzKwKkqzfGL2sgPtJ2NmOD8srhcAPQeOo4FKAOkEI/3PGYbbF9RqduIoswSFnxz+CuvCjK/efJvJvAI9LD5dLqR/+qpXOISNzxvkg5dRkzDKRnJfMQTODJEjMupsJs4+uAQN4oTgp4Olq98XkOzKAq6u+cp88cuVO8jwC90fH4XORaW33z1YE3Ykl1CP3Yp61NQDOjByS++ya+o8a9h/AoF/fzvXx9bTrE+di+PPlVdIrunbwr3NgcLJMZQi0c8387rTfug9pN/6u+bJGmXSHzRynaj7e8SWZBmrxC3HpV7Tr+JE0zZuSi60y8wduqzouSMcbvkCaVKxqOLLXt8dacWQuKOtEzFRt4GSNN9y6MpPFSIMIMtuDOs2cp94MFSMMvXwCwVWeJaQXbwsX9pgsKKoiDOpzhLr7Z6bPpt8JFfYddGkTxohV1M80MoN7vtdE3EJxdEO7GbRTFc9qJFYMcTyvT/G3vXO9okjJrAqK+c7tzirdqKWi386R7mrQDKKrWqVL7ny9moLKMr9UAGG5/YOlSbEim6ajOdxkFiEtuFdSc2jdAUYTXcZW7G20HYfuiiqJ7tMrWBkZnfLxYDZzHXvyFPCAN48ApEg8NGNescdw0PAJL+zXDDOgB+c6zrKG+VBwOQCAR4HRZKTMm3GkkWKbyq/PUcL5GHW8pyFt60cVNWJuQuVQJt/exmQ5+XYNwmUub4ADMzUci9n7D+Dgu3do+kKlaPZ+viJQf0mFo2ZOGJLgBefKTCWlV7NRnyMH2qZf1eWtytJfWuyEaf3ReMDTys2qkAaBP7yOOPWI89akn4xiOC3P33B7xDfgmVt+kgmlD0GarAYX0WCEM3TLuelvi/v0sO2b0/QQ1z7sXrAy+Mzi7jS3Kg2Lv39SBTLV/K/rNVwYn0T4MYtSJDJR5/KzA34y1KH/06ML6HYUtE0IqKajuvbeJVwa6Wrj/+2lt8b1zy/uvgr4TAID1GKkKK1TBzirJUTLTLFKJ6AllSn7ioLS2BH2nyxk0+PsWU0D59iMpX+Nux29aJ9zRRThF9BvoIBqaU54C/m9KSrJ5GPnW9cgakHocNJgSNFaOuB4mUhbVWy7+SEDrvMlCxxRjo9RwcOnSj4GjHmPuEwEmFMviBQmDoKzUUhw+jPt2Dv0U0NLYVXas17BQeuaF+Kc4cSx5tOcch8JWEq2NlbICTaTqQ3Jg3CmqKsSVT2qLfnt4jsB24T5gPPU1ZG/w0VM+z4jTaLvtp6+Ld1icUWC/dGwiT6yDReEVA8sxfaow== 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)(376014)(7416014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OCmKzSWvX7hzlWZn6tNCEgTXIbqzdGtaOwK6u1dpBHoLKlR7VEDubfyYxniUEsKEWfnosiOuKga2T+HzM7gnh0+mCRgNQVUwQxWSru1N4pfjMDC4B1yPx01j+0L91CI2vgiGB1ffP9GY4ytbQFu6p/RiX0zkSjtCkqFDnc2VQeZRXY6zGSdJH3vJ9gIt1ZijXoAi/LObfRpVslDFQgYoGQYCJ4rxCKVLAzXQY7sGgJVWkeVAg6T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NcgKjD5lpQTyCeGcnC484j9tS4LS2hMU8SUmABoeWX8y36M4RZOGzbaKRETDvZeaQWdh2/LwuK2sVvm7mI6vYS9Z8DAHE1nnQcXE8M4f+1AwdWbewUyUkgzmtsroslngGw4Mbe/NJgbT7jZuZl7qXmate1DEahSq7N5wKdrYYRHeIFDUwZC2BlM2RZhR9TRT0Y34pY+pSwJn9uaLlNbZ+3gbVY88neh7xCuV8qV3HoEPWBL0b3fLDinlHCQYPg/xMVbx4rSWxEIuqRCpNP9 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: F8V+pcFNYGanK0xIhNdGUrG3FvRFqkBfmG6poy3261+EpQqWLK8GYcX7TQWXhP9PyJYethR6FKsr5a7WIvC88Off+OyvpiahjSk0aPStba5j+cExaYbv217H2TgovIMKB78h/4gKuE4olRuQKD+iBWbausnAf14rAMBUjgcAxaJIZEJJ+CvmqeiHTZYeNRtqyKE36cfenoKBOZyBmQIvp/WmlefVUcLo3KZBQnJFfh0c6OM5vnxuueSOmt+5hHXl/vojGDSratczH1AN3YoNoe/OGfGw/T8+ILjVzm7E/i5839ub0ltI4DiCgAtstQNgKgbC+XSpwZIErej7kt92wd5hV67ckOWjzhAqoKR3f+DgJzVw+mOzVdXK7SyaAZJ/KOVOuM/Ym6OcKE1UB2UycS3ylgpFFHwW1E4GBK/Jj0E39I8gOecoSYBiZrNLRCVUPHC+aym6/RMN20mM010UqoOPw8KZnjovHwsFpL+WO9E/Lmyod4yBevNoY2ANel7LKKCpEipk0IFtvbJPIV7t4xJ+qqiXFs5Ul/Q0QCmcULwdwVK8xt6cng4an1avtvcUYLytZZU4BFCFEU8qpI7BYxITz8Vaiobe5qtdvb46raw= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 780c3f00-8115-4fe9-a8b0-08dcc2e04d61 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7933.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 19:26:20.8584 (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: WvIQwv7ZqU2bMmO/vCef/lDNz36hDfwRvGa2vi4bAIIZ8x6ue8wYekpAYqPJpMH9OYNjukoLBuSfsJOIz1JyBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5729 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-22_12,2024-08-22_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408220146 X-Proofpoint-GUID: q_GWAb19fzAGBZlH96lLEyPpnhj6Bq_4 X-Proofpoint-ORIG-GUID: q_GWAb19fzAGBZlH96lLEyPpnhj6Bq_4 X-Rspam-User: X-Stat-Signature: w198r88o8mcozoqq3145zhtgi3bi5sp3 X-Rspamd-Queue-Id: 9910316000E X-Rspamd-Server: rspam11 X-HE-Tag: 1724354823-664635 X-HE-Meta: U2FsdGVkX1+BFh18l0VwwKZnVsVwVJ26DLxLIhPTTG/eMFLlOF8BCw3Z4sPLVFaqNZKxYbZA/pO+Q7kGoDaWUVrpsBK8D4BV04qHp4UCD+2NJUY0EWyxUVS5UdR/WzkqKxF0jtutLVVTuS7RDbNJr7FCBUIdV8AULm08qrAoD1IpJY8QstrsJONNG3X/QCeSNTC1fIfjru/rcEHnAJtysLb3QOU00VnVB4KvPbU3J7r3yQw2jp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8l7CEoRG58SwAQYQSrNfk0K7n3s2HctdA7pKHikhJV66q4xh8whV8Oa6NWYP3w/ZxP/GkdbPgha5pkVned0/3wUT4T8GMikn3w4smc7MizdYiyQaQPSQFB88BmQ4kkcATEtJHxmRU1WSOfiCgFErwuHI2e3PJs1Cr94RM3/RG8hgi8ykZ9alvVBN+1gND+KcXUAULBXG2jQi/snFRPu51Ddtb1uIJf 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" Clean up the code by changing the munmap operation to use a structure for the accounting and munmap variables. Since remove_mt() is only called in one location and the contents will be reduced to almost nothing. The remains of the function can be added to vms_complete_munmap_vmas(). Signed-off-by: Liam R. Howlett Reviewed-by: Lorenzo Stoakes Reviewed-by: Suren Baghdasaryan --- mm/vma.c | 83 +++++++++++++++++++++++++++++--------------------------- mm/vma.h | 6 ++++ 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/mm/vma.c b/mm/vma.c index e1aee43a3dc4..58604fe3bd03 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -103,7 +103,8 @@ static inline void init_vma_munmap(struct vma_munmap_struct *vms, vms->unlock = unlock; vms->uf = uf; vms->vma_count = 0; - vms->nr_pages = vms->locked_vm = 0; + vms->nr_pages = vms->locked_vm = vms->nr_accounted = 0; + vms->exec_vm = vms->stack_vm = vms->data_vm = 0; } /* @@ -299,30 +300,6 @@ static int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, return __split_vma(vmi, vma, addr, new_below); } -/* - * Ok - we have the memory areas we should free on a maple tree so release them, - * and do the vma updates. - * - * Called with the mm semaphore held. - */ -static inline void remove_mt(struct mm_struct *mm, struct ma_state *mas) -{ - unsigned long nr_accounted = 0; - struct vm_area_struct *vma; - - /* Update high watermark before we lower total_vm */ - update_hiwater_vm(mm); - mas_for_each(mas, vma, ULONG_MAX) { - long nrpages = vma_pages(vma); - - if (vma->vm_flags & VM_ACCOUNT) - nr_accounted += nrpages; - vm_stat_account(mm, vma->vm_flags, -nrpages); - remove_vma(vma, false); - } - vm_unacct_memory(nr_accounted); -} - /* * init_vma_prep() - Initializer wrapper for vma_prepare struct * @vp: The vma_prepare struct @@ -722,7 +699,7 @@ static inline void abort_munmap_vmas(struct ma_state *mas_detach) static void vms_complete_munmap_vmas(struct vma_munmap_struct *vms, struct ma_state *mas_detach) { - struct vm_area_struct *prev, *next; + struct vm_area_struct *vma; struct mm_struct *mm; mm = vms->mm; @@ -731,21 +708,31 @@ static void vms_complete_munmap_vmas(struct vma_munmap_struct *vms, if (vms->unlock) mmap_write_downgrade(mm); - prev = vma_iter_prev_range(vms->vmi); - next = vma_next(vms->vmi); - if (next) - 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, vms->vma, prev, next, vms->start, vms->end, - vms->vma_count, !vms->unlock); - /* Statistics and freeing VMAs */ + unmap_region(mm, mas_detach, vms->vma, vms->prev, vms->next, + vms->start, vms->end, vms->vma_count, !vms->unlock); + /* Update high watermark before we lower total_vm */ + update_hiwater_vm(mm); + /* Stat accounting */ + WRITE_ONCE(mm->total_vm, READ_ONCE(mm->total_vm) - vms->nr_pages); + mm->exec_vm -= vms->exec_vm; + mm->stack_vm -= vms->stack_vm; + mm->data_vm -= vms->data_vm; + /* Paranoid bookkeeping */ + VM_WARN_ON(vms->exec_vm > mm->exec_vm); + VM_WARN_ON(vms->stack_vm > mm->stack_vm); + VM_WARN_ON(vms->data_vm > mm->data_vm); + + /* Remove and clean up vmas */ mas_set(mas_detach, 0); - remove_mt(mm, mas_detach); + mas_for_each(mas_detach, vma, ULONG_MAX) + remove_vma(vma, false); + + vm_unacct_memory(vms->nr_accounted); validate_mm(mm); if (vms->unlock) mmap_read_unlock(mm); @@ -799,18 +786,19 @@ static int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, if (error) goto start_split_failed; } + vms->prev = vma_prev(vms->vmi); /* * Detach a range of VMAs from the mm. Using next as a temp variable as * it is always overwritten. */ - next = vms->vma; - do { + for_each_vma_range(*(vms->vmi), next, vms->end) { + long nrpages; + if (!can_modify_vma(next)) { error = -EPERM; goto modify_vma_failed; } - /* Does it split the end? */ if (next->vm_end > vms->end) { error = __split_vma(vms->vmi, next, vms->end, 0); @@ -824,8 +812,21 @@ static int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, goto munmap_gather_failed; vma_mark_detached(next, true); + nrpages = vma_pages(next); + + vms->nr_pages += nrpages; if (next->vm_flags & VM_LOCKED) - vms->locked_vm += vma_pages(next); + vms->locked_vm += nrpages; + + if (next->vm_flags & VM_ACCOUNT) + vms->nr_accounted += nrpages; + + if (is_exec_mapping(next->vm_flags)) + vms->exec_vm += nrpages; + else if (is_stack_mapping(next->vm_flags)) + vms->stack_vm += nrpages; + else if (is_data_mapping(next->vm_flags)) + vms->data_vm += nrpages; if (unlikely(vms->uf)) { /* @@ -847,7 +848,9 @@ static int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, BUG_ON(next->vm_start < vms->start); BUG_ON(next->vm_start > vms->end); #endif - } for_each_vma_range(*(vms->vmi), next, vms->end); + } + + vms->next = vma_next(vms->vmi); #if defined(CONFIG_DEBUG_VM_MAPLE_TREE) /* Make sure no VMAs are about to be lost. */ diff --git a/mm/vma.h b/mm/vma.h index cb67acf59012..cbf55e0e0c4f 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -33,12 +33,18 @@ struct vma_munmap_struct { struct vma_iterator *vmi; struct mm_struct *mm; struct vm_area_struct *vma; /* The first vma to munmap */ + struct vm_area_struct *prev; /* vma before the munmap area */ + struct vm_area_struct *next; /* vma after the munmap area */ 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 */ + unsigned long nr_accounted; /* Number of VM_ACCOUNT pages */ + unsigned long exec_vm; + unsigned long stack_vm; + unsigned long data_vm; bool unlock; /* Unlock after the munmap */ };