From patchwork Mon Aug 5 12:13:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13753568 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 AE38FC3DA7F for ; Mon, 5 Aug 2024 12:14:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82C786B00A3; Mon, 5 Aug 2024 08:14:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 762356B00A4; Mon, 5 Aug 2024 08:14:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5417D6B00A5; Mon, 5 Aug 2024 08:14:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 2F3E26B00A3 for ; Mon, 5 Aug 2024 08:14:39 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BE560A8A45 for ; Mon, 5 Aug 2024 12:14:38 +0000 (UTC) X-FDA: 82418085036.26.66CB922 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf20.hostedemail.com (Postfix) with ESMTP id 5E7B21C0006 for ; Mon, 5 Aug 2024 12:14:35 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=i5j1v96r; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BLPxSQOG; spf=pass (imf20.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"); 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=1722860068; 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=iWgOVVMp2+tW0FhzdmTzuZixiBNib8oI0PxjDIzzFQg=; b=NmaMKyISxAlGh6JyiDIAhCXO6Z2XVc0av5uRRQTQ1ccl4iMK8uwQmbWoBQ4mOIdns4vHSK FTxLUPg/rKtgwbRPVLObhpBJHuR6NE+S0PM98WWo+3l5yFCLUP6BsvdDPzAIfj9TStuK3u j5B8/3j4T49Nv9NX+wUL9HP30IVPrN4= ARC-Authentication-Results: i=2; imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=i5j1v96r; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BLPxSQOG; spf=pass (imf20.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"); dmarc=pass (policy=reject) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1722860068; a=rsa-sha256; cv=pass; b=qQk+bF7HNv29LfKjj8qRbQ9gE6y+TqYzRbynMPSp6dpk4SkA+MaYK6reqVutZynp75jNq0 nUefk66WooDNeKO5DhCD7i3XzZhwA5B1xaWiVM9dmzOEnpn6/ZiNbLZPA4NkTFdk8FJHW1 YcGhDDckgw3hsiNNNWKCoSxMK9ybVy0= 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 4758fW0E028157; Mon, 5 Aug 2024 12:14:34 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=iWgOVVMp2+tW0FhzdmTzuZixiBNib8oI0PxjDIzzFQg=; b= i5j1v96rGeohR2uDyEOe90dcKWhZ2BVCoMWZ/VndBgLiYHInjR1nrInwkeO/LyH+ X4Zos/6i3sGkPidX6dLPBl9QvTKazAgOZiEJ1pB33fQ4OwQTsttlJ5XS48JXsy5E LnF1ODYimcjjUDk2Y4ZmkUtidh0AOIdRoyxJBOzpx1LwKxaFg1eHnBHc1lDw1s3X emWWtW7jB3c+cbz26QErxhR8+QJIOsCayUq4T2a7GxExq3ErVFkvBW6o/M7+5zIB dXu/8j71FjTGl14Lsev1IWvHQB204ybeLZ6DTg1s90FPvYzZLP6cB26aPYUI5n2F LUwIktVUu6JjNQfTU0VxmA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 40sd3uje5h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 05 Aug 2024 12:14:34 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 475Ao2iG005668; Mon, 5 Aug 2024 12:14:32 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2177.outbound.protection.outlook.com [104.47.55.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 40sb0d6qbt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 05 Aug 2024 12:14:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kQNIQhaKiGZ6s7ew0xZW3opvikekQOtH0p0Syovy72qX6a/3+e0qerB+psrSYOpNrOqTpX9lqNnM1EbWB3KiKtE1Xh6ASwfi66tMTWkWar5j50DG/8xmDgz3NkwPFoyq9G/ScF8Z3caZHPZFCFN08lZoLlUePOeLKF7mUaJQl1XTvwcWacduiaSmk5EHwou90SmzDKuJEYxzI0kJ9es8LVEjzjP5vmIqWK9V1/xvfSgb12Bx22AENceTxJbv3VLOc/Md6gIsmTLjwRJL9Pbp5Pc2ricuK548MkECF7zAF05QBJ/LAPw++rp4HK+7gbEWhIjNK/Fm48tWHmAUNBI+qQ== 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=iWgOVVMp2+tW0FhzdmTzuZixiBNib8oI0PxjDIzzFQg=; b=dwU1za82vKDbaS3p0u4F4IlpMPko5ZKG9C6GV7uoe83wVQUUWDXHnOqOf00qAD5HaaX8TE7bozRq6sAg2qTQDduQ6rJfIrbWIf2hsjeqN/jlEMMLj5P3GQr8FuBFkI1izxx+cmHGpmOXaCsqtYIagZ454NRzAkTyvApNou8g+VE3ADbF730x2UutnCvHvqXTDgMQVocCKZvW22oXe70sWxxUSFfm/GAQCrfxRHwTH703GRaI4qN5bb1tPGCjL+ncXWFswCI2UT+LpkrflPi93XyvaoNUEdZrI7f4Agu3+Ike6UKQdDA1fcUTgKsc7xyg3NREOGEgngcC45m77m2Y0Q== 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=iWgOVVMp2+tW0FhzdmTzuZixiBNib8oI0PxjDIzzFQg=; b=BLPxSQOGw/PIP62QiORqppEuR+BaAhrXmGQmAGl4fn33C8SDsOCENK/rzKZ1aU60Z2hLbrIdpTxRSOgp93pQHibGSR6nrWO0y14gd/K3ZdylEVngQdX7pEnhrSnl6z5rl33kp9YThXVBTaJ9WH9Jee7uNU7HeKukg+oJi6BekIQ= Received: from SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) by SJ2PR10MB7760.namprd10.prod.outlook.com (2603:10b6:a03:574::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.26; Mon, 5 Aug 2024 12:14:30 +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.7828.023; Mon, 5 Aug 2024 12:14:30 +0000 From: Lorenzo Stoakes To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Cc: "Liam R . Howlett" , Vlastimil Babka Subject: [PATCH 05/10] mm: abstract vma_merge_new_vma() to use vma_merge_struct Date: Mon, 5 Aug 2024 13:13:52 +0100 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: X-ClientProxiedBy: LO4P123CA0137.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:193::16) To SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5613:EE_|SJ2PR10MB7760:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e1dba1d-c138-4570-c50a-08dcb54828ca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: Kaux5jRHOhpecVd2nIYeD5B5yjhA7GR9q5mK4nshbSY5JZADKiCbDIYO+k8NimCpxkSrR9La+bBK/GV4qmCKqPceJG7UQtEJCuBGMsm/5QBNNII0O2wVYxyWMS8qqsf6q/FsT0GloWFT6ZbdUbidiragrEVWrznuZgkw9UaiI6WmhFfQRTy9zQRXhfFzrv6Bm2eMIUib+8ng82vAe2RSaYDreV/AjrN5MO5S8GU6Ms7DQOtB3EfxiuqUKZSV7Rk7wwHP2EJXBmjKKIDRuG9p1MRXsLTt/+BhQjvPYvgeEVepTRXh39/6wHLAQo3WaS28IOf85NQhqhI68zJBXwi0iUAdwpD40c8SU1H1naR+jIwOEYCIQKPN2UDEUDIfKXtGoDvSROXmqsXxpSYFylwrQ69Bo0SqIYe+HNPFAc8mtaeveU/zrIJ070o49BDUBBfS7SFf7hszLxhvqPjOkul6lxdxr5mzxcHjr85MuNjxsNyDbcPPHwo+8NNoyYqj6CMs6r6lAq0r8tjO9oTPE3/EMeksJ48iBWSmMMHtiKmhkpGDXV9O6ATTx/B1Gtswc3tIBXUuUKpZc6wFXANh6BPAJyPgFn7nI4tpBy7mcYD62nk2Z7AeURb4v3DSw1pw5eqmjvgxNEvbWutXRk3Dyh8fUjifbMU7eWvfz7LGu8hV1IKNdrFPBm5Blwjdin1sj/OWup0O8z89l+1FCf7j1gKIRviia59k7qbjEoZmkQeQNxXKk3CXU1xoqOMW3sFysBdhz65LJzhQxT7bf+V55Dzm3KoVo5Q0QhrifQbBkwmCOLz+XsnRFDGnMptmUiBCj2SBYCek1DlyY0RNgXDgC4KYU4MphLIe3PQ8vJc+f9YnffDZlL6bpRLkkwQpIA+Jpe4xsjSHFbY8Ll7msV3v8xKPMvdGgLSESIpg4tDVVDJWa7uQDlC1R0Ks0eDB/r7TgRQ2WW1THEBUIs7SaP0GxQs1nns4+1Bv1o1DuZWqa4wBT6yQYI0yWCi/DGIKxHS7972y3WBJkx2XEQb+XNvmz79W2vhgWg8W0JsD7im16f4i690lCdjmr/VfB184XeDhXngmgedvUS6rgN6TvFzMgQXn+rW3XIj9zzqESWbznOxV0unVWCbX/RNcv/MYD12Vq01ZFYVgsB1WVzlFfgKaAxET8r2b7eUZGasJselqtxfV+4na9FbbMueZCMquHPPBgNDRNm6bPZ8dIt1t8JYTXV1tj4Y/OXBD2BzBWNrycTYDcLspzbtZxINXmSyFWgILfFRyBS0aS3Mj3tD0Oc4QbEC38yUS7VErpQqVZz/O7+jLZRBUPNWOE3AUAoQmjEfOk0Op9gG7gesd95W41ZrUXyu9Pg== 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)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Tt2Os9h9RbwXZk2oqyglKlUZkEgsSxjDksRyonFbYBSTXucUKIwfX18Tg2YSWTKJka5NuSfGurajFkLCUVS4o+MIbcwFCIdz46aJL5niiH/Ap8qQ763NXIL4GKwIH9eqEUzZ+5DEVtTJY0hTVcu7vtVDiU3ixtp04C2EWW76dYz6q4g8mzABxr8Kq4zkt+iHVuFDKw0t+VD7MlqjOLlURDnzlLUamaaQ4H2SAAVTnn6QvwPHzfrZI1N40Nhp9pgJ7EJayCJ9yeO7rUHfXry87BONd8GQfINmgTIqj9Em15CHoov4zt5zC0dawxXQ1sLmCgUgNfB2TgJ3OLhb17dzRVf5WH0a+UrAbKJzdCbYK7mttCorJPL75afDNtDd6j1b6onVYG/P8FGPj8P4JfJn15ELIH+Jx2Y9fgcpA3q0M2yl8RE8OLM8KUf9eFvOr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XGmwf109fO/WrWjdP8ZqutHRtefsg3KnxJZDIP1VBHwZQxBb8IRr6Xu9o76g4JMgMsi8t3YJa0ISs+DyNNuH38nuKBp303NUllpgbuAPrmoOeShhZ+a984UjfHW6TJxWvdHi8gIsRrMhq4rdDDpvtpOMBfAudmfQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: NXm/a4pLN0XeyAMdK6L+YSsVdNX+0cvWTu0QrfmJ8bEE+QuC3n9WdFsRefyl/+OpIzw51nEl5P5QGWfvlrOnaTr+Hv9DthC8GrnBe0cKHuglANzfylQckXIQ8MlOp+IYaMVU+TkNnfHzOIf2wkAjh9tAJFJIK5If1QnDsgM+WsSYnUDkjL7cBHqpuDGBxR6+PZdLFAZ2NkggaRoGnGF5V4BWQFhJOy49CN2r+qsHFAhTcOiY6cq0Zh4dHFKlUZcyRtAxRdhGg0vfYnO2tSEH/sLBxLKqfmLnG90a29lbOKRdpoN+S4GmxzrhKWg6TLzRutx9b6yAaeuXWHD9I41dXPrLuAMLir52sJJwhvCYZbmIwSupKZCoZu9+ORqPvG+V7po+MR07OKm3/oV9DQAVJjb8lZEIvJ7JmEHXBM59j+04K7D4iKd3ncXTg2vgqShSQfeZaHb7eGQpWGicZF9CtbgzAmBN8ND/MK0N8dt6PbiXXBW0CDwnOmgATbTYocwd775JWqp68JIJqSPx6Z7/p4vZJq1SjuyFS05oF9pdX3VksjwBlFmeH5vhGn09SRF9MOxTEkt1ns75doC3HI4yn6a7um+p704ZM4+lJZLyy78= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e1dba1d-c138-4570-c50a-08dcb54828ca X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5613.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2024 12:14:30.7228 (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: udmpVCuv+PVPkUqIyqUVRIfT8eQ1VbjvhpOy5T0UcVAnzywuuevc/9EGYW4yw/3Tm1dDCStNF+tVYNeEnDpRhyodOcY+16/wKubNw4hQEc0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7760 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-05_01,2024-08-02_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2407110000 definitions=main-2408050088 X-Proofpoint-ORIG-GUID: MOlCFEfnMt_JFrjzqmQIGRRNQRWk8jCH X-Proofpoint-GUID: MOlCFEfnMt_JFrjzqmQIGRRNQRWk8jCH X-Rspam-User: X-Stat-Signature: jgymogjq3ryezf7rnjof6y5sfzasntnb X-Rspamd-Queue-Id: 5E7B21C0006 X-Rspamd-Server: rspam11 X-HE-Tag: 1722860075-594903 X-HE-Meta: U2FsdGVkX19AT4tORQNcA7m5nZPzvWLKDYZNjsV2gxWEBTjwYR0rLCrx/IdJNGycrRveIFB2fYMRrYh72a0t1JCUzEKNZ5aOB2RYhaHzt4Pzb3OXv57Luc3Bgs3kOQC2rhQAa52Flm8NLBJPLFGXZcaaFy8I+N8nSU5T0G4TvcviuDs3P4OwhxXw+dkCw/UyDDUAqKwUzRcQLbjbkI0Lp9GbR45Spr8lM1LMupag5jCS2jvvR8t7wpaFKV1OFnkm1OngmaBAYUExWMsUn/m5dSCnVmjOYwSHafwH0yo3pKxNu6F9EKGWrNJzENByN90Ke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y1Ry0VvUO+LNHxkyLyJMc3lB3RgplF6PWHkEWdSxIKYtludNfJ0LoxMptN2F9syML2UZMWiFMZQ2kcskLyuahc0BRveB92O63kiHmMNvnUxrp3riGPZA= 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: Abstract this function to so we can write tests which use the newly abstracted interface and maintain a stable interface for tests before/after refactoring. We introduce a temporary wrapper vma_merge_new_vma_wrapper() to minimise the code changes, in a subsequent commit we will entirely refactor this function. We also introduce a temporary implementation of vma_merge_modified() for the same reason - maintaining a common interface to the tests, this will be removed when vma_merge_modified() is correctly implemented in a subsequent commit. Signed-off-by: Lorenzo Stoakes --- mm/mmap.c | 6 +++--- mm/vma.c | 33 ++++++++++++--------------------- mm/vma.h | 33 ++++++++++++++++++++++++++++++--- tools/testing/vma/vma.c | 12 ++++++++---- 4 files changed, 53 insertions(+), 31 deletions(-) -- 2.45.2 diff --git a/mm/mmap.c b/mm/mmap.c index 04145347c245..f6593a81f73d 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1494,9 +1494,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr, * vma again as we may succeed this time. */ if (unlikely(vm_flags != vma->vm_flags && prev)) { - merge = vma_merge_new_vma(&vmi, prev, vma, - vma->vm_start, vma->vm_end, - vma->vm_pgoff); + merge = vma_merge_new_vma_wrapper(&vmi, prev, vma, + vma->vm_start, vma->vm_end, + vma->vm_pgoff); if (merge) { /* * ->mmap() can change vma->vm_file and fput diff --git a/mm/vma.c b/mm/vma.c index 3d6ce04f1b9c..55615392e8d2 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -1106,6 +1106,11 @@ static struct vm_area_struct *vma_merge(struct vma_merge_struct *vmg) return NULL; } +struct vm_area_struct *vma_merge_modified(struct vma_merge_struct *vmg) +{ + return vma_merge(vmg); +} + /* * We are about to modify one or multiple of a VMA's flags, policy, userfaultfd * context and anonymous VMA name within the range [start, end). @@ -1260,27 +1265,14 @@ struct vm_area_struct * Attempt to merge a newly mapped VMA with those adjacent to it. The caller * must ensure that [start, end) does not overlap any existing VMA. */ -struct vm_area_struct -*vma_merge_new_vma(struct vma_iterator *vmi, struct vm_area_struct *prev, - struct vm_area_struct *vma, unsigned long start, - unsigned long end, pgoff_t pgoff) +struct vm_area_struct *vma_merge_new_vma(struct vma_merge_struct *vmg) { - struct vma_merge_struct vmg = { - .vmi = vmi, - .prev = prev, - .vma = vma, - .start = start, - .end = end, - .flags = vma->vm_flags, - .file = vma->vm_file, - .anon_vma = vma->anon_vma, - .pgoff = pgoff, - .policy = vma_policy(vma), - .uffd_ctx = vma->vm_userfaultfd_ctx, - .anon_name = anon_vma_name(vma), - }; + if (!vmg->prev) { + vmg->prev = vma_prev(vmg->vmi); + vma_iter_set(vmg->vmi, vmg->start); + } - return vma_merge(&vmg); + return vma_merge(vmg); } /* @@ -1295,7 +1287,6 @@ struct vm_area_struct *vma_merge_extend(struct vma_iterator *vmi, struct vma_merge_struct vmg = { .vmi = vmi, .prev = vma, - .vma = vma, .start = vma->vm_end, .end = vma->vm_end + delta, .flags = vma->vm_flags, @@ -1425,7 +1416,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, if (new_vma && new_vma->vm_start < addr + len) return NULL; /* should never get here */ - new_vma = vma_merge_new_vma(&vmi, prev, vma, addr, addr + len, pgoff); + new_vma = vma_merge_new_vma_wrapper(&vmi, prev, vma, addr, addr + len, pgoff); if (new_vma) { /* * Source vma may have been merged into new_vma diff --git a/mm/vma.h b/mm/vma.h index c464d25da120..50459f9e4c7f 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -134,9 +134,36 @@ struct vm_area_struct struct vm_userfaultfd_ctx new_ctx); struct vm_area_struct -*vma_merge_new_vma(struct vma_iterator *vmi, struct vm_area_struct *prev, - struct vm_area_struct *vma, unsigned long start, - unsigned long end, pgoff_t pgoff); +*vma_merge_new_vma(struct vma_merge_struct *vmg); + +/* Temporary convenience wrapper. */ +static inline struct vm_area_struct +*vma_merge_new_vma_wrapper(struct vma_iterator *vmi, struct vm_area_struct *prev, + struct vm_area_struct *vma, unsigned long start, + unsigned long end, pgoff_t pgoff) +{ + struct vma_merge_struct vmg = { + .vmi = vmi, + .prev = prev, + .start = start, + .end = end, + .flags = vma->vm_flags, + .file = vma->vm_file, + .anon_vma = vma->anon_vma, + .pgoff = pgoff, + .policy = vma_policy(vma), + .uffd_ctx = vma->vm_userfaultfd_ctx, + .anon_name = anon_vma_name(vma), + }; + + return vma_merge_new_vma(&vmg); +} + +/* + * Temporary wrapper around vma_merge() so we can have a common interface for + * tests. + */ +struct vm_area_struct *vma_merge_modified(struct vma_merge_struct *vmg); struct vm_area_struct *vma_merge_extend(struct vma_iterator *vmi, struct vm_area_struct *vma, diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/vma.c index d216e51206c1..4416cfa93056 100644 --- a/tools/testing/vma/vma.c +++ b/tools/testing/vma/vma.c @@ -53,16 +53,20 @@ static bool test_simple_merge(void) unsigned long flags = VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE; struct mm_struct mm = {}; struct vm_area_struct *vma_left = alloc_vma(&mm, 0, 0x1000, 0, flags); - struct vm_area_struct *vma_middle = alloc_vma(&mm, 0x1000, 0x2000, 1, flags); struct vm_area_struct *vma_right = alloc_vma(&mm, 0x2000, 0x3000, 2, flags); VMA_ITERATOR(vmi, &mm, 0x1000); + struct vma_merge_struct vmg = { + .vmi = &vmi, + .start = 0x1000, + .end = 0x2000, + .flags = flags, + .pgoff = 1, + }; ASSERT_FALSE(vma_link(&mm, vma_left)); - ASSERT_FALSE(vma_link(&mm, vma_middle)); ASSERT_FALSE(vma_link(&mm, vma_right)); - vma = vma_merge_new_vma(&vmi, vma_left, vma_middle, 0x1000, - 0x2000, 1); + vma = vma_merge_new_vma(&vmg); ASSERT_NE(vma, NULL); ASSERT_EQ(vma->vm_start, 0);