From patchwork Thu Aug 22 19:25:31 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: 13774113 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 715D0C52D7C for ; Thu, 22 Aug 2024 19:26:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F1A6E80051; Thu, 22 Aug 2024 15:26:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E531D8004F; Thu, 22 Aug 2024 15:26:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C571680051; Thu, 22 Aug 2024 15:26:41 -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 9ED548004F for ; Thu, 22 Aug 2024 15:26:41 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0E341121468 for ; Thu, 22 Aug 2024 19:26:41 +0000 (UTC) X-FDA: 82480863402.26.A232EB7 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf27.hostedemail.com (Postfix) with ESMTP id A15EC40012 for ; Thu, 22 Aug 2024 19:26:37 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=K6l03OSv; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=oWUDkyDG; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf27.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-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724354716; 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=jbqzxUpWaWhe7HX9TTqUu2TcUsDnEJBssn9V4YZ/Zgw=; b=4YcAHSNlWSKjUSzttJNEZR4HGquyYcYXfXcZrw7zJS+ZNRAcwcZVXNYumYKBVFmh0SS/Zg Xb1VxjxG1pJT6noNkMCNAi9CUAYMbsq7NLDOA1wjuHZv7ZnCnwgeqq6CO/+hok4nUKp5So wZkU4aLo2kOoacZm3mTcf/lgPaX+vE0= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724354716; a=rsa-sha256; cv=pass; b=YZ1VHhVU4dZi23vfVhVvOsrubWZerO+QSJYt5tE0pSv6hrcAwiTIMa/awsGTjnPZkgB0vz DGV36V77VaqQLDPdNFpmZjxf4CiJxweiHXN738dFmu2INJjhDvAiaAMvd732iwdlQ3Qyd/ 3l/Aajog+YvGLbtpdeowX0IMONMC9tE= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=K6l03OSv; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=oWUDkyDG; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf27.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 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 47MIMWp1019191; Thu, 22 Aug 2024 19:26:31 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=jbqzxUpWaWhe7HX9TTqUu2TcUsDnEJBssn9V4YZ/Zgw=; b= K6l03OSvOpzRptIlJrTntQ44YyewF3XNDFmUO0KLsF6uxQBQKFCq7D841twyZGj8 eMlOyy1Ts8M5Y4cOtOtfbv46pcnQQLUTo/b5BKmEGPuqPZ/pTUdUx0PZEJ0WdLn7 hG++dY/RE6GpyPfMMVJFBqP41v4Nk5VkKXNNxLHWOpIcUCKH153r8Sksep7/Rm9C x8vh4BN0TtEz63aGTN2VFzPKl/0n/COUYJz9CgFUQkOLReVeNSM0SDg6VEYx5SDX 7egTvuHSIsmIC/abup2JhAsMNFtWIb4cL7k0RKSM2DVvxl+BaqAFbbdhKQ4MII2C ntnsENVfO+F4V7Xzj/XnBw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412m45jw9t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Aug 2024 19:26:30 +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 47MJJDAA005150; Thu, 22 Aug 2024 19:26:30 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 416bcu0830-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Aug 2024 19:26:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UzezXIb3l5IvbG0edol9qE+NzezrHfQA9S07W7Jx8obVj/dAYKBbYIpNe1yvOBW3ujx7i4n0pbPX+k/VBUvtJeifPy4F40R7jho0a1vWHCptZeqZLwFRsTNvxSOrSSrKG8uRkGAuLdu2hu6bWyd3Ue+sIOv21zqcYCYxPyWHAZXBDl5NmFmQHOqRJZ6FN6U3JQ0fpLSnGrYXLH7lFObXek0cUj7Ytvw7iEFfZbELwHZ/uJpoHhOlIjfu0YYjwqqvnZiyFUtHiF8o2gltq0B+ttAKW32UkAziP1TLCLjfksRxI/o6glZcrvWRLxbLokzQK96xS3MKI/HqkDnIeG1PmQ== 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=jbqzxUpWaWhe7HX9TTqUu2TcUsDnEJBssn9V4YZ/Zgw=; b=P+ST1HZMOhfeYHg6huLximeHUZ/QHhkUL5ogGv8Y2nW1rwh3Uc5QJd+cmjRXAf7cFhrX4aaaAHekNeWLMAnHbUFEhfJtUxBheS8xomqNw/zT9e5z8qVx1klQt4Ujh2J6UA3jlMC0/ode98gvF//PxlabVsU0ex7YPO6ZcNPbdZ5PkR7cj36RIDrozHFfTq+Z9a+FoUuNJUvkpHjsLK/9D0MhuSAS/zgKrBox6eZrt/6h1mJZmRTYnCS452DBTU2A0DoQUF3EVxLpjftEiW46vhqL/yFjud62ewSGordxI2LbnEHsRV3ITRWOCNPf2TmOcSFOx7YD4N8+7Yq76SfVqg== 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=jbqzxUpWaWhe7HX9TTqUu2TcUsDnEJBssn9V4YZ/Zgw=; b=oWUDkyDGcDEu9JsI3oUKVBqWyQSXjCDjX0u93+CJ3x4XLQ+st3wO4DFGt53G37NNpkTQZGMYKqTt5VBZHQhrRB88E5RumW2PB5z6TIr8cg0FE0paSBzHsXQcGwkDeMHODoLswd/ki9uqdjPNDHLo26BehUi07c1y0g+Y+W77sKU= Received: from DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) by CH3PR10MB7356.namprd10.prod.outlook.com (2603:10b6:610:130::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.16; Thu, 22 Aug 2024 19:26:27 +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:27 +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" Subject: [PATCH v7 09/21] mm/vma: Expand mmap_region() munmap call Date: Thu, 22 Aug 2024 15:25:31 -0400 Message-ID: <20240822192543.3359552-10-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: YT4PR01CA0408.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:108::13) To DS0PR10MB7933.namprd10.prod.outlook.com (2603:10b6:8:1b8::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7933:EE_|CH3PR10MB7356:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ec38b72-d7b5-41bc-99b9-08dcc2e05133 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: LEsX88v9PAIfVgHjRJO3egkqiTLScIJ6wtrGDCdzBOEYEVS/7NhmoNpJhtO2djBtxpe4bJuyRcy4dRSJsUm+rAeRCTmQWVSmjAYwVk3Glpp+fQ8wV65gtutsXA16Yy2jOLSHzFZKMMkBpwvKj25dzJWxWvIKHlJL+JoJg6ax/34j+qQZE6WW5090aECqYcu//7MnZ9DEqt9xWvs9+K4779+ARoV44scyN1R+isrfQl5Df3NgKTxFS+KAGXxrC58ItSpphbYjo5hWuthinqvF6NSA9OQl9G7xy7Re3W2IO5d2+WO0m4IXzB21iC7HF6G1ys+Ql8EBozK7yTJQH+V2RXaBf4qPw+iJ7ZoYVH/207UmoHQv0xOVPkasWO5pSAcM4HYQrKOlKkt/8s5aIQeq7lZxmTKa0QcIl32zu0KkwlDvmz7qeama9nfJwCvXIJoHjHxZ+Qw9cEJRfxIEmqL/+AN07H1P2s9ANo8sPdwCJyTcRtKtG4PppDcWjQ0KC1Of+ZY7w48Pgz3kqFOOlqA08EFSMalLT9bi0dJ86FUywXDFlcsCe6EZeCqAx6+Gc38CHiNHOaHbXsIPMlfwwDJIWtaOvvCbosLcjRnW8SeebcJX+XDEM4Nfq8XBZl4C2Dk+TmLu4a0W3dmNy0RXVFhKCCAliO6QIGGggxqUc+uK72jRAfe/IyYTJULdQ7YQIKc8Yi+yvITpm4yPNPitCqSkXPJU0N/QAW1eV6HkBnUlEA3JOZ+higHO3g8X8tngZfR6BsTReaumL9Tp5WXlNthNpOJ1uZQGLnSt1nb22ZbPSpd2cVLT3O2TICOwCq0S42tV6V5cS2dpGJxOM83waCjU5T9uyAzkpX8ubfGVeFArFRxGKNemQxtQYhzbl+7NOjKVQoH+5RGQZVcWD7t6O+q8qS1BdzwvMqb7dWeFcSalnBA0dmVSbFagx1D8sf/Gva3u7S4kpHOYUONTZSGoqdbCEoigKe6o/pYAahrc28ff2l5RVr7pfNPcARZ1pwOBDyj6mNEjt1jPDXfbjNhINuRELg7JUDwuujnEK10LVjPlTvbPeR3k5fbTtkLRe3Z6tN2J4YeYpF3WTgu3EY4x6T3qYbxi4wZnyE/p4ulA8oJy7+1pLs3YgYBQpYq0ctDeUGCdqVEuM8GVReVs+/qv52QSLfImOlj8Oqbv4SVwXbMcQ8aiVZbcBeqoi3X2Y4iAB0V+mMp15+MRDKK2wbyVIWL9+PAe8SYZFF8PN+FsY4l0pa8jQSpRdBGhvMShR+Q6tG4RsLJzpoJcU+OrKTE2Bbe2FG2gOHAeZhtsyf5CRqCCjPKpbids0NtcyWBc0Sha5yXH8W0TPJthH3/6ym5Ln088cw== 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: s2JXRcJLYvNAEiZzwI2bjfv2+sp3cou3XENZ9DVWGT+wjYAR+mm2jIQYWkMxNrcKcx6TAZWVeJfRDnLFDu9r3bB/PoDg3yA5+UTE5y8VfXnupzN7olRmf0rX7Sc/m/BYfoy++dSLMR9Leidr/rMYWRXzgxj/6Xjsd3mPZM8GCIdFUNKb1OxpnC+IAiJn9dKjqPUP9Ux3ikec/LcaOxmuUhKPK3cT6/u95JW7HGj2AfbKzEVWjBJKzC1AzkNh0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tVLIa7f64tUK3C+2ozqoTeN0AxjJYiz0ewqZs1k1WwFZU1sh47CUw3FrDmMVx+qwKYp9+T70TVPPXqIIFjQKGF4zW0sheI7MYJEHkRItCkAd3mz1CRq0EMM/yhtidIs3BiFLtma8XdUc7p/mMN2L/MPlsIO4kibnzRYT0astamJNHMUdhEigffcIffMAGvNNjN+A/eqPoAcHFj598KWL5VUOoYQ0xfPsnwL3dAUTmuP4Gi27GDJFRFuMC6P863HVUuYmQgf9bD7t5ick/GxE+dfgHX/qfdoTFWNg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ip5xySYsH8W3ZSq4IRupNB5r/NUw7pz8ICUrv7zwWVs/k/y20cQtckxoWNtlqD7H9sDsREp5bs27XhUrgqEL7cIrp4BLr+/3vlpEvrkaZs+nnJgBSETgM8KRKsCBsJVXOj2I/5D1/c8BKZotUMLyRHKV9mUtsmn0pPGiG+rUjzSWzug7C5/4L30tQDW0hreG/DtgX19+QAeVUF+jyqIz/iR01W/kcqb/gMTTG1YbUF77gzA3oNdeUKmGJPBhRL0BuowU/T4CqDNQBlYikXSn/mUSTrHi0SwYgFPdUu9tsPAjGcbcpJiJ1DBc0vXBe75p24cN8YEsH40DshjhNZW96MmMKwTvuavVA4jJfb0Z+fjLO93GakSDRO48RHnu5UW0DZKtUqA5BBiAbfNPcx0jExcWfWlYiqbsH94XaLIoBKStR7JWnFv0ab6OPMBhNaL31f0II52fctvcHfPXSqmUGAEq+sVdpECYwmvgd1chVpw46M1D90/tv9M/DtHzfLVRTDQRYUfUF2Ho5gTEfQOMkvq3fUtBttep3UJcjU5sDAuiAy7zFJ/6n6habkeClIJf5I1XzRDRr1qeDIJfu0E/1kyhG+X4TIvT+yVASXHPDxQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ec38b72-d7b5-41bc-99b9-08dcc2e05133 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:27.2878 (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: wxjpVKx/aAihFkLjjsOrc0OHttvSit3O9Juf4rthlm//io0M1N3O/4Xzfy5skWHyZaMeR2TfcAfnfaGy8JPVlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR10MB7356 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-ORIG-GUID: -oVfmSUzkAXdTqBC8nxOaJP-ptN09o9d X-Proofpoint-GUID: -oVfmSUzkAXdTqBC8nxOaJP-ptN09o9d X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A15EC40012 X-Stat-Signature: jqi9f3y3ic6pa6sd8hgjkdrzmimtkbae X-HE-Tag: 1724354797-122124 X-HE-Meta: U2FsdGVkX1/3OosCQBCFKKVFl0KJyyUnCL5dF+2GYA3L5GJutrtN/BSwqeYMz3K0traFa/umIXDxivdkW5QvCd6yvR5nFJQGqF+Tz8ZqFrhmKu7AVrXK982BU/dIkkV30fR27KHAXFLQf8PjwBcJRZP86zn7zDatDMj5x89leIig7tyO2/s5CW0JgQ0D9w3iVPkQ3NxJZxWdywowl7TJTz9Mlu3za5uJ9V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YuS5t50P+p0GUn0T64SEEpGOFMpeJLU9nsC256hOxa5vDnAc6IEWFTjEKr7chL9SwA5pjhOhY5GGmYRH31wISYGRP9DdwGjID86D3OP70dmFkcqVA4+9RZxjqka4FgrGa4UGOlC6zlmy45yD6inl8YaFF7uYXxkcnQ== 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" Open code the do_vmi_align_munmap() call so that it can be broken up later in the series. This requires exposing a few more vma operations. Signed-off-by: Liam R. Howlett Reviewed-by: Lorenzo Stoakes --- mm/mmap.c | 26 ++++++++++++++++++++++---- mm/vma.c | 31 ++----------------------------- mm/vma.h | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 33 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 0f5be29d48b6..e7e6bf09b558 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1366,6 +1366,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr, struct vm_area_struct *next, *prev, *merge; pgoff_t pglen = len >> PAGE_SHIFT; unsigned long charged = 0; + struct vma_munmap_struct vms; + struct ma_state mas_detach; + struct maple_tree mt_detach; unsigned long end = addr + len; unsigned long merge_start = addr, merge_end = end; bool writable_file_mapping = false; @@ -1391,10 +1394,27 @@ unsigned long mmap_region(struct file *file, unsigned long addr, /* Find the first overlapping VMA */ vma = vma_find(&vmi, end); if (vma) { - /* Unmap any existing mapping in the area */ - if (do_vmi_align_munmap(&vmi, vma, mm, addr, end, uf, false)) + mt_init_flags(&mt_detach, vmi.mas.tree->ma_flags & MT_FLAGS_LOCK_MASK); + mt_on_stack(mt_detach); + mas_init(&mas_detach, &mt_detach, /* addr = */ 0); + init_vma_munmap(&vms, &vmi, vma, addr, end, uf, /* unlock = */ false); + /* Prepare to unmap any existing mapping in the area */ + if (vms_gather_munmap_vmas(&vms, &mas_detach)) + return -ENOMEM; + + /* Remove any existing mappings from the vma tree */ + if (vma_iter_clear_gfp(&vmi, addr, end, GFP_KERNEL)) return -ENOMEM; + + /* Unmap any existing mapping in the area */ + vms_complete_munmap_vmas(&vms, &mas_detach); + next = vms.next; + prev = vms.prev; + vma_prev(&vmi); vma = NULL; + } else { + next = vma_next(&vmi); + prev = vma_prev(&vmi); } /* @@ -1407,8 +1427,6 @@ unsigned long mmap_region(struct file *file, unsigned long addr, vm_flags |= VM_ACCOUNT; } - next = vma_next(&vmi); - prev = vma_prev(&vmi); if (vm_flags & VM_SPECIAL) { if (prev) vma_iter_next_range(&vmi); diff --git a/mm/vma.c b/mm/vma.c index f061aa402f92..6b30f9748187 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -80,33 +80,6 @@ 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 = vms->nr_accounted = 0; - vms->exec_vm = vms->stack_vm = vms->data_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. @@ -698,7 +671,7 @@ static inline void abort_munmap_vmas(struct ma_state *mas_detach) * 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 vms_complete_munmap_vmas(struct vma_munmap_struct *vms, +void vms_complete_munmap_vmas(struct vma_munmap_struct *vms, struct ma_state *mas_detach) { struct vm_area_struct *vma; @@ -752,7 +725,7 @@ static void vms_complete_munmap_vmas(struct vma_munmap_struct *vms, * * Return: 0 on success */ -static int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, +int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, struct ma_state *mas_detach) { struct vm_area_struct *next = NULL; diff --git a/mm/vma.h b/mm/vma.h index cbf55e0e0c4f..e78b24d1cf83 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -78,6 +78,39 @@ int vma_expand(struct vma_iterator *vmi, struct vm_area_struct *vma, int vma_shrink(struct vma_iterator *vmi, struct vm_area_struct *vma, unsigned long start, unsigned long end, pgoff_t pgoff); +/* + * 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 = vms->nr_accounted = 0; + vms->exec_vm = vms->stack_vm = vms->data_vm = 0; +} + +int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, + struct ma_state *mas_detach); + +void vms_complete_munmap_vmas(struct vma_munmap_struct *vms, + struct ma_state *mas_detach); + int do_vmi_align_munmap(struct vma_iterator *vmi, struct vm_area_struct *vma, struct mm_struct *mm, unsigned long start,