From patchwork Fri Aug 23 20:07:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13775913 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 D751FC531DC for ; Fri, 23 Aug 2024 20:07:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1BBE4800C5; Fri, 23 Aug 2024 16:07:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14AE0800C1; Fri, 23 Aug 2024 16:07:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D60E1800C7; Fri, 23 Aug 2024 16:07:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8F3DA800C1 for ; Fri, 23 Aug 2024 16:07:33 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 46D55120D7A for ; Fri, 23 Aug 2024 20:07:33 +0000 (UTC) X-FDA: 82484595186.29.6ABF73F Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf03.hostedemail.com (Postfix) with ESMTP id CDB5F2000C for ; Fri, 23 Aug 2024 20:07:29 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=msiUYvij; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=o2WezEGI; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf03.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@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=1724443558; 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=N0jU9GfEGn2Y+Rp/ei4IM2Nkf6/N/D+Xhjwf9ZOd8E4=; b=0nWX2Y+DAs0FDSjB3hIJKonDhi+Pg78vmaEeNXgBZWE9jG74PcqGSM3Jg09/GkVF4+PDHX wQak2Kr+d8sh+F19wrgJ72QP2WaSk/d9m6VHIBqsHReARAUw7FShjfy59xnUsa0aihddFd LMj0Ag560TmrKckB8s0Liq9hJLt1Szs= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724443558; a=rsa-sha256; cv=pass; b=ZdUUfB2fbIhryYgk/icf+srb7EDu9Um15n2WvdNQdip93aTcEY3BCorXnGFKRfjmdXtVNi RUm+wzQLnlewnOQAs2Gk4isDRDciX07wiHVoZUQWxYduaKSjSofl0n1xB+Jx5pBF4WLRmu ArxYtrPJHwMY8yPXefsmq3EjzAPgwsQ= ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=msiUYvij; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=o2WezEGI; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf03.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") 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 47NH0UQB020538; Fri, 23 Aug 2024 20:07:28 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=N0jU9GfEGn2Y+Rp/ei4IM2Nkf6/N/D+Xhjwf9ZOd8E4=; b= msiUYvijmvwxBEbqsY23KDN+YkMw19/zh+r+mmhOSXitG5M2ZBV5JCbn+KEnTWMY E4QVvXxYZiNQwMThXm/t5s1ccFif3toZdhJ1W4AQsEDCrtizGlxaWQ878EWX00+H vHOFnDIPFasW+OTE8E/v3ByMGjC7cKkchM5zIx7qyU/gfkDGnpTU1fHESY1lZyI4 MFSttF9VfjyCtw556UwoPMlXGIzwFPCxAoIrZBXeA0AgIN96AzMWeJSVxpM6Ka7n 2P7a6nkq9xM2zh0RinJ2naPSuC/at8smDUWrmtl38USj9TUFhHUKVWtxQvZiONer RwrR/VvdSRlhTsi4agUJoQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 412mdt56b2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Aug 2024 20:07:28 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 47NJdFFg007123; Fri, 23 Aug 2024 20:07:27 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2177.outbound.protection.outlook.com [104.47.58.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4170s610wk-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Aug 2024 20:07:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IUfaGgJbuRgvjzWLgHXct3EPZepjBaFud6WSHjBjDgXUXBfVk84uo5zwfSGwNvx7cX7Hl1Y7gR+m8uJtIOVyGUqRihF8qAfaCr6TCwQ53FffadoJDRaw+4pCfjdcd0f4rzGS2TxCnZwKf4MyaKxODcVBshsWsy8dDUKGBiu3fVQPf88sS7+w1tcWMwhk+JS9P1MH1tA4FmlQ+CdQ/A6uow9stRESjd6x3KE4SJmg3Vcz5Uk2bWzYAIY4665AZOsadBQS++Ilt9tQk4d3aIMiIiO68EHlSLpr5oBz06Z9v8Cg3v620JQ3BTj8swgiUa2v6AtURDvJYZjR0yjSueujoA== 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=N0jU9GfEGn2Y+Rp/ei4IM2Nkf6/N/D+Xhjwf9ZOd8E4=; b=m9xYN30+WNW7GeB4JBwAN+OuHvT2FGwe2sxdTpuZbIhEjI2p5RM/2aDKNbNxUkZBR+b73el9TXt0Sfmvwgtu/WWyZkbHEes/FVPkRj/NYWuYvdzLcAt0XDUJf2VbhFyUbo6REwww6NNmNfnx/6R3QoYmdvV7p17Y2sq9pKdPq/Qb5PZOiONLZng0ROZQl4m6K0MtEkx8CiJA0UhVPM0nrvGoBWtEFaB1JHimbjyeG1ECBeFF8T6G9uIQbfv3NCmOijNTJbMcJKNqffwBh8n12r8Domk8+mTRDE45CrE77vyIeu+ixdIFW/svXA3uhz0jiXsX394lg3hd5/SkjtMTmA== 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=N0jU9GfEGn2Y+Rp/ei4IM2Nkf6/N/D+Xhjwf9ZOd8E4=; b=o2WezEGIZhG6NYQOryPd59WXZ8APzpldVR/cxdqwQXWqQHQ+yIypl+cSB7B/be7rqf3VqY3XO6siXtFm9+Otc+HFi001onDmsryRU1y+QGIf4Ctw7wUwIK5GD7uFmurqhhJfYkHwJdXarDCXd2QRiMEfJfRvh4vqUG0v2G1fFNA= Received: from SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) by BL3PR10MB6187.namprd10.prod.outlook.com (2603:10b6:208:3be::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.17; Fri, 23 Aug 2024 20:07:23 +0000 Received: from SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e]) by SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e%6]) with mapi id 15.20.7897.014; Fri, 23 Aug 2024 20:07:23 +0000 From: Lorenzo Stoakes To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Cc: "Liam R . Howlett" , Vlastimil Babka Subject: [PATCH v2 05/10] mm: abstract vma_expand() to use vma_merge_struct Date: Fri, 23 Aug 2024 21:07:00 +0100 Message-ID: <0cc0e4d1af6722b3b0d121647089659bd8060087.1724441678.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: X-ClientProxiedBy: LO4P123CA0288.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::23) To SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5613:EE_|BL3PR10MB6187:EE_ X-MS-Office365-Filtering-Correlation-Id: 1205a18f-9ab9-43f4-7270-08dcc3af3332 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: is8c1VreVyKWLkbi2zdH4H3JVbrUx3DiOA6DaziGkRHsTwRL7D0EXygLeJ+Bu7GitrYHjwgoXQ8adgjiVGrjRCkVGhKYdOT7MtbQvZf88yPOQHzSkPvxtTkLOPFj/xPDVQ46pXI09wJU5HBWPWPUICIRsDNJTrjGWoyUagQX7zei0O4GM6kDWwhkHFwOo+sBlUXHgKx32S5mDQTEw1P1g3rDKUKmpUKAOMY80dWNIJUOX1J77GML1pWOBjfxoExxK11MxkczRG53ZuNmC9NsvK3QSgcF1ZyaqQFu1IjUTmftoRgzu1ECKtLqJP4pJ1yqM/CdQrfsyPWaKuQwJBYEZNqdhowqbjGgzftwOCIZicpRjqnBnHekwlKry8t92s/Q4766gttr5hYOYJm8Yl89Son6RUmVosZTTMcFTdAXoOAWUeP3p/OTwXjczodH/A5hqQKmN6M+1SxyFPGdWM9/EWJZeR5E1Vnx/qpGmrq+xG0eA5gPPPihQbebG3ED66R7ia0k11ebOmTlT2pvqL2LVIMR7g0S+dUNaFUXNn6cH3uVJEHpSoOw6F5Bc7HT8/wNhyuPG+ENrYv59nPLGN8sVuqmb1MHTl/ArabBra3Av4jzs+aGr2msZt8vZJPySeZaad22zreuZftK5J5DUygX2BnPpiqE6i6NrVUQnov8JnbhkIaqifJlqXvBYMzPlWhtiMucXMC4XJuuRP6Cle4eFeSjOy+EI8h6gziCDQcCs5dRiPQ/Ov+/ado6YBD/rw/fJFO4lKZoyrtec9kniN+8xbG6fIl/ObUBXIr5UjioUwpaMYarnTk2ZgSP7+fRbhDOlIyac6swcPVCyZCTiRQ+TLTntgH33fsApFrlMwTmIX444XJkLT/r3MoQxeV+L49Oi5vJDqM85xgmyGmHEyWVNifbTeUNYrTLY7HoLTkWuOSXnVr43rQsQg36AQqfjxf/u8j8j3c8BcZ9dPR8VJYVSxgWNwxvOc55wiTnJWrQVmy9aDAlrC/E2TQPWs0FHQ1EzzpDi2assPR3YBGJP5LjT/d4C7mevK2PiSoCe/gvF5EQLYmpEmuyIx08t3sawIqz3Wwf7dP7Qm0l5TAtOmTY00bliUCIevh+zzLMYldLpyMQppoSULVvc2+7DJEc5hzOsj4WeyYFJVWqWCA4sThZ88EDpEbcSWLwMgZ5u/6wZ0zIMUOHE0frPBmfJL0k0m/jXu8Na+j3n5J5sE/tIQdyDc4nrD1G9AkEx7zSTfD4xRTzhTsW+SdkQiCE1/Aa7dn8fWW1mXE916zp2Qat9heEdHKA9DVj+U/zkukWlxsmd3Mtyw+uJOr++VPD3s7i+l/aBY8ldI/EZyPICwyS1tgR2Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5613.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AAhlbtvxUFVpTsVZL8G/77ih/MwQDS0aj1dmkSvDImNcDbBhozlL2iBKtERbQ3XapPCdm+jAR+uKoEOl46BJdgApYj4vMWKBVuzQwNBPPt7KJoCZo4jj5c144sjhIIuL/rAVB4hFYjGaYbob1DXnVBDbyT49M0nGiGmYGCMz0LNYg5JzKCxPZJaDO0Ff6EmR1+4r70uVUSKHEmzsA+OZdaJuLGwPYxBXQC+UHnAGRaQtcAHzSdHSSzrflJrsj6KdW+kM0Qz/M1FFcUwOAbaM02NytBUd8LGH8bClaWCFPI/XAbb0gRWMyHER0Cj32ANswxN4LGC4ohJPMYddHtRANNzSSqMU2MyAYEHyBHDX5D5IJRkDDh+EfboXUqR0y+E3jiJ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KAnmx9AyVM2hBS29igr8k2goyxOQXX8R4NcTyL4ymLix3+La1WUYBSyt/zj5j38Iz9SHACIMW/OMBthl3u9mh8RxD0cqntwlI8UASVY2FZHsrsnpHweWZ3kU8SLBTSVYGhuM3hyCfbP8Hly5JhOkNA3P6mbZgA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: qgcQZuY2npfNL+u+pw8x/y6cYuhaDYXLvQvMrnuJZKJKs8iGjvkr56IwIDiH2Dt1EL443//DFRdiqMSwnpf3/Sm2g5Wl9yE3s69FoKpOqfx3cKB2dwSgLS+QjcHNeG+bDDcvDGiGd+6Ju25HerN8d8dhtF6nD+g1GoAqyo7yMwkSzUTB5z5NVIFo1vJ3eQWTSNnk+WcNC5CvTGzUw88gOPPRzQviV1gcnqa6yAIFSKIf6V62j+OD4GxbXbnne1zMrfe0X0hR1gUCw9PqEqC9MPXBv96vcxUxsMvs2STH09knbRk8pkADhkVy5UJqEA3GCzBNOq1BXuJNTZ4jlMS5JqIUNOXJ/1WcCv5xZofG20VP3bvY/MCOG255t6lZ5gr/GY3wbHUhjcPtn6O1o2bkDTwQOK6rvrT4TXNShDjCw4WjYBQH0j0r9XuW7pvBWs//QiXnPTkvLxgGoPE10mRr2FbG2ZmW8TaKquAQpgIkOkXEFzsXAPVBEypMnBOa/nelhoOlq5vC/zjwhwUrkiWJ8ie6Anee1gezKNpQrGRm7imPzZsqbFxYOl9o5/UF4B+FwYLLSha4lRqkSEbglOvBBESM7moCzYmeKhvoGBhBVxQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1205a18f-9ab9-43f4-7270-08dcc3af3332 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5613.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 20:07:22.7717 (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: xn6coRJbqU7E5gku93I2udU+HyjHtnG2s7e0GFHcC2zTPO39GpxhDXfIUmRDDecQCBcTG0UKi6qT8AvBV1yEmHzD4Pa4P02GeYSw8qSr8gU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR10MB6187 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-23_16,2024-08-23_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408230148 X-Proofpoint-ORIG-GUID: Oy603X3y8QiBTD0ccsaNoNTODcPmRYde X-Proofpoint-GUID: Oy603X3y8QiBTD0ccsaNoNTODcPmRYde X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CDB5F2000C X-Stat-Signature: p8gswrbndmpzsuwbfuk53dnfacpsdjn3 X-Rspam-User: X-HE-Tag: 1724443649-334145 X-HE-Meta: U2FsdGVkX199PDXgqwJ5O/AX+BK7txSaxdzQu9nmFO4knCCY4aADKS+gW//i4BMyLDG8tDFHHqvA7Io0T7sWzeAs4kcexgP5SR6zQte5dlcj+EtzFH1Q4PLuk1tBAfzrmA+UX0B76ycRsRHfXXhJRr/iqdigtem5zmQyqu+i/+OyB35WkwU5ZNCABQcB1L1ECYM27uDBX44KDVu1VriC9Ri0yDa6YfHjoL6IoMiZOweGnqDmH8NgIdT+B+kaivceH7TcDkZUiVh2JsE35C8eZoQDIyIkOyb9smaZ/ee54bAwfm3YaFlJCcrB9me8Cj9AJhXmn4X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roHRCozP/sf/6VkS7y1smCAld+y3hWHSVjkLdAyyvvDTFUxyauYhZaZaFwTrDL+N13D7m0qjFLIBBlpnUzYRN7s2bvMEnf7wB1WpJs55pYfhdW4rOtivV/zE= 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: The purpose of the vmg is to thread merge state through functions and avoid egregious parameter lists. We expand this to vma_expand(), which is used for a number of merge cases. Accordingly, adjust its callers, mmap_region() and relocate_vma_down(), to use a vmg. An added purpose of this change is the ability in a future commit to perform all new VMA range merging using vma_expand(). Signed-off-by: Lorenzo Stoakes Reviewed-by: Liam R. Howlett --- mm/mmap.c | 16 +++++++++------- mm/vma.c | 39 +++++++++++++++++---------------------- mm/vma.h | 5 +---- tools/testing/vma/vma.c | 3 +-- 4 files changed, 28 insertions(+), 35 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index c72f50feb98a..0d242c9b1f4c 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1371,7 +1371,6 @@ unsigned long mmap_region(struct file *file, unsigned long addr, 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; int error = -ENOMEM; VMA_ITERATOR(vmi, mm, addr); @@ -1424,8 +1423,8 @@ unsigned long mmap_region(struct file *file, unsigned long addr, /* Attempt to expand an old mapping */ /* Check next */ if (next && next->vm_start == end && can_vma_merge_before(&vmg)) { - merge_end = next->vm_end; - vma = next; + vmg.end = next->vm_end; + vma = vmg.vma = next; vmg.pgoff = next->vm_pgoff - pglen; /* * We set this here so if we will merge with the previous VMA in @@ -1438,15 +1437,15 @@ unsigned long mmap_region(struct file *file, unsigned long addr, /* Check prev */ if (prev && prev->vm_end == addr && can_vma_merge_after(&vmg)) { - merge_start = prev->vm_start; - vma = prev; + vmg.start = prev->vm_start; + vma = vmg.vma = prev; vmg.pgoff = prev->vm_pgoff; vma_prev(&vmi); /* Equivalent to going to the previous range */ } if (vma) { /* Actually expand, if possible */ - if (!vma_expand(&vmi, vma, merge_start, merge_end, vmg.pgoff, next)) { + if (!vma_expand(&vmg)) { khugepaged_enter_vma(vma, vm_flags); goto expanded; } @@ -2319,6 +2318,7 @@ int relocate_vma_down(struct vm_area_struct *vma, unsigned long shift) unsigned long new_start = old_start - shift; unsigned long new_end = old_end - shift; VMA_ITERATOR(vmi, mm, new_start); + VMG_STATE(vmg, mm, &vmi, new_start, old_end, 0, vma->vm_pgoff); struct vm_area_struct *next; struct mmu_gather tlb; @@ -2335,7 +2335,8 @@ int relocate_vma_down(struct vm_area_struct *vma, unsigned long shift) /* * cover the whole range: [new_start, old_end) */ - if (vma_expand(&vmi, vma, new_start, old_end, vma->vm_pgoff, NULL)) + vmg.vma = vma; + if (vma_expand(&vmg)) return -ENOMEM; /* @@ -2368,6 +2369,7 @@ int relocate_vma_down(struct vm_area_struct *vma, unsigned long shift) tlb_finish_mmu(&tlb); vma_prev(&vmi); + /* Shrink the vma to just the new range */ return vma_shrink(&vmi, vma, new_start, new_end, vma->vm_pgoff); } diff --git a/mm/vma.c b/mm/vma.c index b1ec412fac7f..4867ae722a9a 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -467,30 +467,25 @@ void validate_mm(struct mm_struct *mm) /* * vma_expand - Expand an existing VMA * - * @vmi: The vma iterator - * @vma: The vma to expand - * @start: The start of the vma - * @end: The exclusive end of the vma - * @pgoff: The page offset of vma - * @next: The current of next vma. + * @vmg: Describes a VMA expansion operation. * - * Expand @vma to @start and @end. Can expand off the start and end. Will - * expand over @next if it's different from @vma and @end == @next->vm_end. - * Checking if the @vma can expand and merge with @next needs to be handled by - * the caller. + * Expand @vma to vmg->start and vmg->end. Can expand off the start and end. + * Will expand over vmg->next if it's different from vmg->vma and vmg->end == + * vmg->next->vm_end. Checking if the vmg->vma can expand and merge with + * vmg->next needs to be handled by the caller. * * Returns: 0 on success */ -int vma_expand(struct vma_iterator *vmi, struct vm_area_struct *vma, - unsigned long start, unsigned long end, pgoff_t pgoff, - struct vm_area_struct *next) +int vma_expand(struct vma_merge_struct *vmg) { struct vm_area_struct *anon_dup = NULL; bool remove_next = false; + struct vm_area_struct *vma = vmg->vma; + struct vm_area_struct *next = vmg->next; struct vma_prepare vp; vma_start_write(vma); - if (next && (vma != next) && (end == next->vm_end)) { + if (next && (vma != next) && (vmg->end == next->vm_end)) { int ret; remove_next = true; @@ -503,21 +498,21 @@ int vma_expand(struct vma_iterator *vmi, struct vm_area_struct *vma, init_multi_vma_prep(&vp, vma, NULL, remove_next ? next : NULL, NULL); /* Not merging but overwriting any part of next is not handled. */ VM_WARN_ON(next && !vp.remove && - next != vma && end > next->vm_start); + next != vma && vmg->end > next->vm_start); /* Only handles expanding */ - VM_WARN_ON(vma->vm_start < start || vma->vm_end > end); + VM_WARN_ON(vma->vm_start < vmg->start || vma->vm_end > vmg->end); /* Note: vma iterator must be pointing to 'start' */ - vma_iter_config(vmi, start, end); - if (vma_iter_prealloc(vmi, vma)) + vma_iter_config(vmg->vmi, vmg->start, vmg->end); + if (vma_iter_prealloc(vmg->vmi, vma)) goto nomem; vma_prepare(&vp); - vma_adjust_trans_huge(vma, start, end, 0); - vma_set_range(vma, start, end, pgoff); - vma_iter_store(vmi, vma); + vma_adjust_trans_huge(vma, vmg->start, vmg->end, 0); + vma_set_range(vma, vmg->start, vmg->end, vmg->pgoff); + vma_iter_store(vmg->vmi, vma); - vma_complete(&vp, vmi, vma->vm_mm); + vma_complete(&vp, vmg->vmi, vma->vm_mm); return 0; nomem: diff --git a/mm/vma.h b/mm/vma.h index 9060a1a1edfa..8f01fbc20fe7 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -128,10 +128,7 @@ void init_vma_prep(struct vma_prepare *vp, void vma_complete(struct vma_prepare *vp, struct vma_iterator *vmi, struct mm_struct *mm); -int vma_expand(struct vma_iterator *vmi, struct vm_area_struct *vma, - unsigned long start, unsigned long end, pgoff_t pgoff, - struct vm_area_struct *next); - +int vma_expand(struct vma_merge_struct *vmg); int vma_shrink(struct vma_iterator *vmi, struct vm_area_struct *vma, unsigned long start, unsigned long end, pgoff_t pgoff); diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/vma.c index b12f72979478..cce1ba78c57f 100644 --- a/tools/testing/vma/vma.c +++ b/tools/testing/vma/vma.c @@ -121,8 +121,7 @@ static struct vm_area_struct *merge_existing(struct vma_merge_struct *vmg) */ static int expand_existing(struct vma_merge_struct *vmg) { - return vma_expand(vmg->vmi, vmg->vma, vmg->start, vmg->end, vmg->pgoff, - vmg->next); + return vma_expand(vmg); } /*