From patchwork Wed Jan 29 18:16:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13954036 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 859DEC0218D for ; Wed, 29 Jan 2025 18:17:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 144F9280267; Wed, 29 Jan 2025 13:17:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F4B9280263; Wed, 29 Jan 2025 13:17:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E1414280267; Wed, 29 Jan 2025 13:17:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BE308280263 for ; Wed, 29 Jan 2025 13:17:04 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 70562AECAB for ; Wed, 29 Jan 2025 18:17:04 +0000 (UTC) X-FDA: 83061295968.17.97C6A7C Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf21.hostedemail.com (Postfix) with ESMTP id 0147D1C000B for ; Wed, 29 Jan 2025 18:17:00 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=GspEyiFk; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=u1ENQiHq; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf21.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-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1738174621; a=rsa-sha256; cv=pass; b=3jeZOL93ZMuOGPFGqxHGhH84reO8hPXt4z1pfEEhXUbOJVTPBlnSiC1xKSTlaZCSptB6sC Fy3tQvm5FG5zpGuq4VkrF3m2BKIVCkQIMWddOMlI1E0kLtddSJbVwZmPVqXSARoFp0Aqxz ydI4uUiLBLcImyMH52rJeSMA30d0k2U= ARC-Authentication-Results: i=2; imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=GspEyiFk; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=u1ENQiHq; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf21.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=1738174621; 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=zuBLPjGNSUMx8Fj6nZFfWbvJyPOQbygIlbM01t+C9kk=; b=UkYc/2+9/j+AEnypw73UlAI/URDbWijwx9FdRtyR+ebHVfgoIqUS4+4ALImBJEEYubRVju rX7HebAFP71fwEySLXG7Ves8j8ZvydDY2cq27HMSjjcTXgZocHcK4p9zN9AtdAEOUQA6as 80g2Jj1SBB3B/CroHvcF7UWNwoWwAMo= Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50THQo9J003831; Wed, 29 Jan 2025 18:16:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=zuBLPjGNSUMx8Fj6nZFfWbvJyPOQbygIlbM01t+C9kk=; b= GspEyiFk4KugGAU/doK4vOGzkRgHMTDPFVgb/DQTKFwG8muELWPncw/EviQZv018 TeTGqqJVZkdkEGf5JzXIofOaUjqRlKo9jnn6r9E+sWXsmcOAsXQP2Z+ojMLO6/Uw wHJbFIzq+ANBhBwPgy0zm7oORWGYG1k82lwJMs8EEKwQFyqG2qDb5RG5pTCfGW7C yY7sLiuUe9c13tL3mOddADJVl8aaeteYQLjXMgdIw+DOCTPA28WnDZJKJXWjHPVH f7mtfYqhMy7l/ag70S394RZiDeeaAXLq2CwrMLAAPGotgkzN59AMVR2kHQvyuZFh ECSbcuYLEO+l0YHh4pIk+g== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44frccr7e6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jan 2025 18:16: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 50THEKQP003410; Wed, 29 Jan 2025 18:16:53 GMT Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam02lp2043.outbound.protection.outlook.com [104.47.56.43]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 44cpda6jxr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jan 2025 18:16:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mzt5z6okw567DRvIyK1kPrd0iG1meBI8fgUQ26HJZGmHseplSD7AM1Xbp3mz7bhLZVnK0vpwFRB8p+Ejd3Y7Fv/TR2cM/+DaZdbN3u2HCG2vYoYTGtqQxW0qQ+Tz7qVhj8b2RLUYWryhvJE/3IcbEtVn+3I53ra/JISAZ0a+v/uX0HMQrM08Eq+VU3h5HJnAzyGCgoJ4gWDpdh6Ooi9BWlWseXwWROdpP4byjknM6WWcBOvid6rugQfetvK0nds2ah01PvNCBuZENYxqIBSIsjNwDIJzADqjn1taiVauMZcOiK029N8XAKXTbCYrwYyuOwg7tECADq7wCH2UIRrzbA== 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=zuBLPjGNSUMx8Fj6nZFfWbvJyPOQbygIlbM01t+C9kk=; b=RgQ6X+eg0TArj203Ab0E1XbA0Jk9kMAyBEuO3TNttA7W/ajTf1cHf+hlGxvafn7NW3pK1jGKJDm+rGvhfScskqxJlFNxmmPJyTk8BBUQPD1VaaEKeUaBUgRJLkZ0gw3gW18FgzzXAVWOLcYW9C2H9ex6jUOyLjs8uiwUEWR/FeQlk801KMYSXgdLqxdz5h3O0HA4Pr2hzSap21jimeIuAiDr3qzLTFsT+A0AF5sUjOa1my2QvD0wNC4d9J9wCnspAJLQfvOunBisK08vCa8GcWnsBivHndJr6mQXddv+5+knoRk9KyXt6sLg2k2KBQNIcpQmrqZefi8/fXTwS1zV1g== 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=zuBLPjGNSUMx8Fj6nZFfWbvJyPOQbygIlbM01t+C9kk=; b=u1ENQiHqKXYV64wNC2A1/aqNK4jefNn13sq3gvCQ5aLk/ZTidpbe2ZQKNDmXgNetuNVL1i5Rh0VYoSIxvPgOqXP4T0QtjTumWU7cPm+g7Xyhq2MCNPJGqz4UK4TJ4UXxmSMCFXMJIHtc8pELNdVVZnZGkxCu2dMEVIPFFR0fK8s= Received: from MN2PR10MB3374.namprd10.prod.outlook.com (2603:10b6:208:12b::29) by DM6PR10MB4314.namprd10.prod.outlook.com (2603:10b6:5:216::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.18; Wed, 29 Jan 2025 18:16:51 +0000 Received: from MN2PR10MB3374.namprd10.prod.outlook.com ([fe80::eab5:3c8c:1b35:4348]) by MN2PR10MB3374.namprd10.prod.outlook.com ([fe80::eab5:3c8c:1b35:4348%3]) with mapi id 15.20.8398.014; Wed, 29 Jan 2025 18:16:51 +0000 From: Lorenzo Stoakes To: Andrew Morton Cc: "Liam R . Howlett" , Vlastimil Babka , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] mm: eliminate adj_start parameter from commit_merge() Date: Wed, 29 Jan 2025 18:16:37 +0000 Message-ID: <5a12615fc1432f353c4424ef58d4ebbda7a08b14.1738172812.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0259.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::31) To MN2PR10MB3374.namprd10.prod.outlook.com (2603:10b6:208:12b::29) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR10MB3374:EE_|DM6PR10MB4314:EE_ X-MS-Office365-Filtering-Correlation-Id: 17b80085-af79-4770-4d66-08dd40911a6c 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: xiPuHJ/W+9r94hWBcvP2/ui7qS3ZEFYxQPEmwUYSSzb/uM7fN+ev0ZEj/Zb2NNd4ZStxyc4+5k0BmxCPlO/sSWqHNE2CV8DrmzqmcQzjDSJaDwRNKmZbFfUbZguJg1/Zw4XjybcbfXH/XBVnCrm3hzhZHu2LeI3d6op/yH1hKs5J0aX+MgMGhEF8Iy7jBHZTWRThpTN3cxaVZl6ih7U7B3jEZuG0g0eY6B0JCDevHbdVn30ekzfk8udDXJZv+SVE1W2KgJzM02k4qVt+oaDA+rcPMSZMybhnqcGUNF4guKQz0oASbjreuSwl6wh3gIlXuWKb0RNDKTDlx32vo9KGA3/ah2URkBkX3t6lwWO7y7jbALMemRQXqeLk9I7TwbQifSAAxGTO38RfEC6B0mT2IHu/WkBsUus1Y5AE/uvKNZXA5SaPBUzXpIPCYFreZDqvOC9Tax87JB8cv2YtksT8t+yS8i3od3jcokRvqwNEi/O5b/3DWGjNVCHiE7mgxoO4jURDfNhXOjP0ixN5pzVUjxF4CzB8s09qEZlafrcXWF69o7VUSZYP1/elfZ5lUz8+FunP5aU6r+GcBhPWkP+LjTSgleRa65upXEcv1Tf8aqlFVKAxmRhslxWP9oEeXdaEC8UsjlkM8lYsRwZK3bCQc9y9kmrxfZ6RWZ3Sc0CPImatVs15Xx5FBlPdZpdKKjynEo0wHSO+lNwBvv+2LgAXkUK0jXssHhGr7kWVrrCNlyvRzzRkLXdFc5enKlKC7eURwrTgUqbf4VKF46JFWhAQA7t482o0lWDSiI1LyhjwvN8mFMIRut0BRv2RR8Br1/8mZgtGo4A/xEy+HeH8fjOqhmEy0hR138QBmtMYjYMY12kpkEoborfxifKEa7fxkMLxY8vb4D+jTqObuR03MdOxQSy6wia3Htqta0w98nqh2bU4p/PUVtGz7GDCOB1s5EIbeIIxH600WYM7xOLEHdWDj6gdTsD8fBVvpWN64A4YFQklxsytQjvBpREFB7jiW3XA/vV+trsqCfA1XZ4dWjh4corKmbvccW3Q5M7uLt4FSI9RIkA4DY0/ROYgP3MEIAlmNwFcEg2eJx4DAqt48UdhjfxaBIoRG+7yMoXOU0O3TJsEFJdU/igY003qFQP3+X08PBbyHNxTalHqklJHHWbQk5ontcHmgJomInxwA7gNMHU/c/NlXyS73BUp73krnfTy5Ds5OveNG4nZD4P11qsXjMs1qxE6EbZA1+KdzN8mMN5VI/3ip6K8tm9oH252TthE6tO2nSIu80Eh6djkpoK3mNnNvRlKtdMbh9ujiP49hw3w19yHmn7hutOiujHy3zi44W5ETupkhfanOK16yO7aPYn5gDebfNwXTO0JZyIv4PVLbhoTttwAqeS8IbGixHyo X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB3374.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: RULCMshJwWLa1E9f/jkJhxYbSf634KW8oj/XYKBrvo/12p9ymnj1NtHIkT+WzKbMSFfaY4vCrC/yXkBf42fj6uXHZ5CP66j77f/vsjSul8OgoQ94GW10Ib8p8MUw010esqMWEGda9Lhkpo1O7MVtoAxYLbm/1nHDD3RBttT5P9eWcCCh8QvjD/W1I+VtZkt4exqgl51zuyDNeeQMOJuSKJvTB+4BHXXAecka0gn3yXFilIGZPTPC2IvBZosznULs5qPMsGZkMwoF+K0sN5CkPkes83kCXRh0nwBLtq2Ennfqty6vhvTZNWVwpryFXOdGpuYwc/YSJsKkJ9JC9tG3cxCECGytIzBmuOBghepht4eVhtyB4QI+H7thbi06Wl7wss1uUmAT6sl2P4a7/Z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C/AlPqgILcG7cUIJ/Cq4UAIMomQL3cCgZsT1aqszHHr9gUVA3V74HGJRs7b7BQ4ZrzZaHlMQAjyybawyaJtJ5YOExo6Q4g2n9fzFoFUJnaS91+1bEIx1ail6ly5EZnFAQvhTaNkmeXg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: MepEcMTy3KtlOtT6Q4DvxRKq8Zs8U5elj5jQrpRhIhsdEiP2gJ/EQUN6Yd0YmRCrj0Jjyw/ajNSSUcKBnUH3mT7ojpmmJIS5nI9oFSW8/ELiNJC33i1MSx4QFNh/ScJc8Wrhn7vgie+qf3yxCs8aE6bLjctEQSt9YyR0krPIzxoY8nFQY1dkNSd0A1b4fKfiCT/Ay2EnHINFRvoFGnbmSM5MMMxu12+SdmKizA+H1tXlJiIZyi1Mnc5B47ZCdodnpOhhBlHdYobsD0rs/Jxso96EAJT1kzID0myJSbWdSg9XmKGf+lo/91qkiYuxat19m7rPLRjdimmT6oAKzAb9GN7bCpE8wJ3q7EHoW4+LWZ5S+qVqZanQb3Ft7//V2Nz9fXcH9jF447dqLwUvRSWPCmTOr5i4X5LDjWTpOjaMicsmcRHQmHWT9YNBoV130fnkzPjwd0D2C5aFag6dcRvOZYerrZQCJVpx9WChXMY3w1lu0sz4An4iMM3hmDx697Fj5AVttB7KJ57QqDBlwNNugWAlf7BhlAsdydXFNn6qNwWcmQYO5zFT3ODAOF3B5zOpmhRHbS4PWy4jB1ye8DJ6U9iUoaNr5jxTFI+Wv7J3TGk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17b80085-af79-4770-4d66-08dd40911a6c X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3374.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2025 18:16:51.6642 (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: z7v4WNSRSNmJorKyxW54hb9BAZ+D7JcGn5RH39en6dqJrfhD4oPOJtjAfvkbwK30EDTBaYotEab0+7yrkDlik9ODFn4UzBwQYppDKf7DOsI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4314 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-29_03,2025-01-29_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 adultscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501290143 X-Proofpoint-ORIG-GUID: IlW52EpNATf-MzfwXxiCNOVbYQFbkO6a X-Proofpoint-GUID: IlW52EpNATf-MzfwXxiCNOVbYQFbkO6a X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0147D1C000B X-Stat-Signature: jo4zdyyucfyzeae3nye4oyaqteh5ah3p X-Rspam-User: X-HE-Tag: 1738174620-191413 X-HE-Meta: U2FsdGVkX19JsGaXpqmgsjp8NAgXSxyvEdu7FaqEp3QPPUIbVmCQqY37WkMNUbmMO7fInq4j8YMF9TKrKUoWvG+xfi/o5cHOmnv2rFhoZQLwAEGNz45xSN08l2Qq3T61BUGmKhSDg3cy+RmF4H/xhRJ/NQ/cV2cnP2m7KJ9AHSHtdU0gVzKDipXEbuV2twMt50SYRl9czKn8CMiJLmksYQqxdXDekPEJWXbpbx6RQjHi3QaIRZasYgEPnWOpudbDzZyJGsk5tId+SYIkunXO2QPUgkWTs1tKrAhD9jj3DdDFuNk8yTwynnx0tZBlPPc6vd3A3Y/cVtY6cIeNW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6BUxv8QR3C0Hx1zru5z6dmTsqigss/NdKT/jAtgOoFLmlWHweZ4oFhyCjTQVsLiE4VI5nhC0cIHtgRFUdD8XQOpRos1QIf6xLIyvu9U6pwJ2czqBiTnZsGwcd6AHBS8puyU7GhlnXeRvAxYyztR82oJfmW09fNoUEkwn8+BTYyDtPuCqEMXVpLWuVnOwPk= 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: Introduce internal vmg->__adjust_middle_start and vmg->__adjust_next_start merge flags, enabling us to indicate to commit_merge() that we are performing a merge which either spans only part of vmg->middle, or part of vmg->next respectively. In the former instance, we change the start of vmg->middle to match the attributes of vmg->prev, without spanning all of vmg->middle. This implies that vmg->prev->vm_end and vmg->middle->vm_start are both increased to form the new merged VMA (vmg->prev) and the new subsequent VMA (vmg->middle). In the latter case, we change the end of vmg->middle to match the attributes of vmg->next, without spanning all of vmg->next. This implies that vmg->middle->vm_end and vmg->next->vm_start are both decreased to form the new merged VMA (vmg->next) and the new prior VMA (vmg->middle). Since we now have a stable set of prev, middle, next VMAs threaded through vmg and with these flags set know what is happening, we can perform the calculation in commit_merge() instead. This allows us to drop the confusing adj_start parameter and instead pass semantic information to commit_merge(). In the latter case the -(middle->vm_end - start) calculation becomes -(middle->vm-end - vmg->end), however this is correct as vmg->end is set to the start parameter. This is because in this case (rather confusingly), we manipulate vmg->middle, but ultimately return vmg->next, whose range will be correctly specified. At this point vmg->start, end is the new range for the prior VMA rather than the merged one. This patch has no change in functional behaviour. Signed-off-by: Lorenzo Stoakes Reviewed-by: Vlastimil Babka --- mm/debug.c | 8 +++++-- mm/vma.c | 50 ++++++++++++++++++++++++----------------- mm/vma.h | 10 +++++++++ tools/testing/vma/vma.c | 2 ++ 4 files changed, 48 insertions(+), 22 deletions(-) -- 2.48.1 diff --git a/mm/debug.c b/mm/debug.c index 92936908ed0f..adddfd69dbf7 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -267,7 +267,9 @@ void dump_vmg(const struct vma_merge_struct *vmg, const char *reason) "uffd_ctx %px\n" "anon_name %px\n" "state %x\n" - "just_expand %b __remove_middle %b __remove_next %b\n", + "just_expand %b\n" + "__adjust_middle_start %b __adjust_next_start %b\n" + "__remove_middle %b __remove_next %b\n", vmg, vmg->mm, vmg->pgoff, vmg->vmi, vmg->vmi ? vma_iter_addr(vmg->vmi) : 0, vmg->vmi ? vma_iter_end(vmg->vmi) : 0, @@ -281,7 +283,9 @@ void dump_vmg(const struct vma_merge_struct *vmg, const char *reason) #endif vmg->anon_name, (int)vmg->state, - vmg->just_expand, vmg->__remove_middle, vmg->__remove_next); + vmg->just_expand, + vmg->__adjust_middle_start, vmg->__adjust_next_start, + vmg->__remove_middle, vmg->__remove_next); if (vmg->mm) { pr_warn("vmg %px mm:\n", vmg); diff --git a/mm/vma.c b/mm/vma.c index 206e3523cf38..3fe264200b79 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -632,29 +632,44 @@ void validate_mm(struct mm_struct *mm) * * On success, returns the merged VMA. Otherwise returns NULL. */ -static struct vm_area_struct *commit_merge(struct vma_merge_struct *vmg, - long adj_start) +static struct vm_area_struct *commit_merge(struct vma_merge_struct *vmg) { - struct vma_prepare vp; struct vm_area_struct *remove = NULL; struct vm_area_struct *remove2 = NULL; + struct vma_prepare vp; struct vm_area_struct *adjust = NULL; + long adj_start; + bool merge_target; + /* - * In all cases but that of merge right, shrink next, we write - * vmg->target to the maple tree and return this as the merged VMA. + * If modifying an existing VMA and we don't remove vmg->middle, then we + * shrink the adjacent VMA. */ - bool merge_target = adj_start >= 0; + if (vmg->__adjust_middle_start) { + adjust = vmg->middle; + /* The POSITIVE value by which we offset vmg->middle->vm_start. */ + adj_start = vmg->end - vmg->middle->vm_start; + merge_target = true; + } else if (vmg->__adjust_next_start) { + adjust = vmg->next; + /* The NEGATIVE value by which we offset vmg->next->vm_start. */ + adj_start = -(vmg->middle->vm_end - vmg->end); + /* + * In all cases but this - merge right, shrink next - we write + * vmg->target to the maple tree and return this as the merged VMA. + */ + merge_target = false; + } else { + adjust = NULL; + adj_start = 0; + merge_target = true; + } if (vmg->__remove_middle) remove = vmg->middle; if (vmg->__remove_next) remove2 = vmg->next; - if (adj_start > 0) - adjust = vmg->middle; - else if (adj_start < 0) - adjust = vmg->next; - init_multi_vma_prep(&vp, vmg->target, adjust, remove, remove2); VM_WARN_ON(vp.anon_vma && adjust && adjust->anon_vma && @@ -738,7 +753,6 @@ static __must_check struct vm_area_struct *vma_merge_existing_range( bool left_side = middle && start == middle->vm_start; bool right_side = middle && end == middle->vm_end; int err = 0; - long adj_start = 0; bool merge_left, merge_right, merge_both; mmap_assert_write_locked(vmg->mm); @@ -858,11 +872,8 @@ static __must_check struct vm_area_struct *vma_merge_existing_range( vmg->start = prev->vm_start; vmg->pgoff = prev->vm_pgoff; - /* - * We both expand prev and shrink middle. - */ if (!vmg->__remove_middle) - adj_start = vmg->end - middle->vm_start; + vmg->__adjust_middle_start = true; err = dup_anon_vma(prev, middle, &anon_dup); } else { /* merge_right */ @@ -891,12 +902,11 @@ static __must_check struct vm_area_struct *vma_merge_existing_range( * IMPORTANT: This is the ONLY case where the final * merged VMA is NOT vmg->target, but rather vmg->next. */ + vmg->__adjust_next_start = true; vmg->target = middle; vmg->start = middle->vm_start; vmg->end = start; vmg->pgoff = middle->vm_pgoff; - - adj_start = -(middle->vm_end - start); } err = dup_anon_vma(next, middle, &anon_dup); @@ -905,7 +915,7 @@ static __must_check struct vm_area_struct *vma_merge_existing_range( if (err) goto abort; - res = commit_merge(vmg, adj_start); + res = commit_merge(vmg); if (!res) { if (anon_dup) unlink_anon_vmas(anon_dup); @@ -1079,7 +1089,7 @@ int vma_expand(struct vma_merge_struct *vmg) if (remove_next) vmg->__remove_next = true; - if (!commit_merge(vmg, 0)) + if (!commit_merge(vmg)) goto nomem; return 0; diff --git a/mm/vma.h b/mm/vma.h index 7935681a2db8..e18487797fa4 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -120,6 +120,16 @@ struct vma_merge_struct { /* Internal flags set during merge process: */ + /* + * Internal flag indicating the merge increases vmg->middle->vm_start + * (and thereby, vmg->prev->vm_end). + */ + bool __adjust_middle_start :1; + /* + * Internal flag indicating the merge decreases vmg->next->vm_start + * (and thereby, vmg->middle->vm_end). + */ + bool __adjust_next_start :1; /* * Internal flag used during the merge operation to indicate we will * remove vmg->middle. diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/vma.c index 7728498b2f7e..c7ffa71841ca 100644 --- a/tools/testing/vma/vma.c +++ b/tools/testing/vma/vma.c @@ -159,6 +159,8 @@ static void vmg_set_range(struct vma_merge_struct *vmg, unsigned long start, vmg->just_expand = false; vmg->__remove_middle = false; vmg->__remove_next = false; + vmg->__adjust_middle_start = false; + vmg->__adjust_next_start = false; } /*