From patchwork Mon Jan 27 15:50:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13951578 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 1F451C0218A for ; Mon, 27 Jan 2025 15:51:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A5A2B280173; Mon, 27 Jan 2025 10:51:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E15A28016F; Mon, 27 Jan 2025 10:51:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77299280173; Mon, 27 Jan 2025 10:51:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4B36128016F for ; Mon, 27 Jan 2025 10:51:27 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EC376802F7 for ; Mon, 27 Jan 2025 15:51:26 +0000 (UTC) X-FDA: 83053671372.02.1823D9B Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf19.hostedemail.com (Postfix) with ESMTP id 3AE2F1A0007 for ; Mon, 27 Jan 2025 15:51:16 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=V5or2bAp; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="eRa/+cf2"; spf=pass (imf19.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=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=1737993077; 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=llckhhPabjSnXQX0pplDVCDofcRfJpYOy2ZcvLXG7Ik=; b=quHOS/hPzg+1H+4sTpVsF2kCc8GpV/LxuGU1Vb8unsAZgfPP07jEME088/pNSlEN8LyW1h cpPoux0Q+hYQ0b8G4QF8Lbgu4ppppRvWFW6tDJuSZjx7xCeWnu3D+qhUz+bmt3IEL9KvpZ Fz9rEWghpcLDzsZQxySXAbMgwARwzN0= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=V5or2bAp; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="eRa/+cf2"; spf=pass (imf19.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1737993077; a=rsa-sha256; cv=pass; b=ZYOzlLrucliOwwbnhGElinKs5FNVCLB4myZRpHsWeQjzJ+MhTJeRnJdUOY7XTCU3SQfOJA djDlLTKJIAkQ0V0zXAbxNfkjqOsy0tl+46M/W2+tUNRtkOwuK9whgnt3K8UkQrIV8OSPRi RLZTxijJqSxlvEC1HfIzvkN9oPOby7Q= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50RFHK5S009502; Mon, 27 Jan 2025 15:51:13 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=llckhhPabjSnXQX0pplDVCDofcRfJpYOy2ZcvLXG7Ik=; b= V5or2bApcWIzJGvqg8dLefqW7mkDiSyVGztrtH+r4zqTGn9N2PEwxnQIkKx+3YWX Q0zLevHYx9scozsLLibaiGZPO/xsID6aavi+VmOwSTUhrTikG0M5wS1Zhiy/EcCd 2CMZKOVQ+uRzkFXsZ/lCLzjAsimkG6ZddbubrqN7PWo1v0eFnExuRFE12Oiiif4Y 5Yp7g3ngISOHnOGI0IiJ227ye5e4MYl2WiDAMi5UaB6VJO4QcljM53JOZRxope+A rXpf99RfvnUjDFDKKmKgJMdggRuU8Gjv4wQyRAtjfvF1xabkbS4mOkWFdndeaBXk jIxhhCnaW/2wakpB0Lr/Fg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44ecn502mw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Jan 2025 15:51:13 +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 50RF40N8005314; Mon, 27 Jan 2025 15:51:12 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2044.outbound.protection.outlook.com [104.47.55.44]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 44cpd75t64-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Jan 2025 15:51:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aESO9ZxnMCiQPieAn+V4Onm2B+jlID2w36TcYv6uYeuPEejwGg4GfR8l71QQs6UvuDtc0jtPVsEUsd/DbYnyFpdfhkilfYINGEab22zdw5qc/gaAgbvCuAOvTeBO3Is7MDfcxpEoUWjdgn8sQAuT7vJaETpeog4o7BqNTxB5XaiJz/DeBSsH31JJJd4bDPlPCgybas8Tnd2ehvlfq6zFPDDyaH4XroGb3ldvz0lGpzxLkclWjiho+tpVJWRyuGf3EZqXtqPz8E9VZYaE72e6Gaedy+33C9tuWaqwmG0kgc4dCnxtDolBa5J34cdekH80L6W57wZccWbrwHatpCxlQw== 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=llckhhPabjSnXQX0pplDVCDofcRfJpYOy2ZcvLXG7Ik=; b=HOJ28pIWndJZY9lguhcOG+lXf1bkBdEY/E+D9OWb/ar2r0jWdYEvBpbB7oYzNHIeKj+wp+AxIt+guHBu99679yNS79IQvCzqVISXVi+LtrFBjpQBtF6ocyl/M/2e6VZ9y8xM+Me592R104UgoQiFkz2XPNQgk1jDicpDQOavULQRgJTTwoE0xvQ6L9SFVQ9EJzj3KviU78AOKhPi/kyAb/d/4Z5Py9VzkmXACRoQnABlMYIIEJhmwpCup2m0IwPtUS/6mTQHjcsB99ONMZ2bpZEr5Y6WC5rBJV1snwCZ6Sppwls2C+R/5VGvgxbKtiJOYhyK5ta+7LWl/esZDnF75A== 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=llckhhPabjSnXQX0pplDVCDofcRfJpYOy2ZcvLXG7Ik=; b=eRa/+cf27wdsdFVwdA9paQYGNSofiQH8MX7q03A/aNPU7SmhqiH2+0nHNZw6cWcgxN/d34K5pQrWd1QmIvNkNfGGjJ6ChfD4/0zvRLAqjZ1KWUpSx3lsQ/DAa4a6vOv2AGWX6NNSDADjW7H62r1BAG41Uujd+mV+AOp4ympCRBQ= Received: from MN2PR10MB3374.namprd10.prod.outlook.com (2603:10b6:208:12b::29) by PH8PR10MB6339.namprd10.prod.outlook.com (2603:10b6:510:1ce::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.19; Mon, 27 Jan 2025 15:51:09 +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.8377.021; Mon, 27 Jan 2025 15:51:09 +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 3/5] mm: eliminate adj_start parameter from commit_merge() Date: Mon, 27 Jan 2025 15:50:42 +0000 Message-ID: <335ff27920d96c2a45b9724725cd3be2caf987b1.1737929364.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: References: X-ClientProxiedBy: LO4P123CA0013.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:150::18) To MN2PR10MB3374.namprd10.prod.outlook.com (2603:10b6:208:12b::29) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR10MB3374:EE_|PH8PR10MB6339:EE_ X-MS-Office365-Filtering-Correlation-Id: baeaa560-0d5c-44e4-9d41-08dd3eea6ad0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: VVdmKMtZkt1wfSNJQvD55OJhwyzN/VrfJbaib50pTxmMHNWySuHA3DYknMlRXEOHhW536CcxshvFOdL+HC8oFH5wdyxMX0+Zd4nYjmrR67TAxdJLWHwb53cKyAJIOIhoKX7LgN3dOheZyLoj/kc47YHNS+w7pO90TIPjp3iUucLO3B3tZk5HQ2zXiwDmHN/ynq1dfjrJhooPY+pDYdLBxtJ/gbF1jjjAqaW+IkHA+kKmvXjjep6zKQtp1hz6DD5Sp9ExBN/qedtHrBOB6Z1Dkg98kM6xg8Pk3WcQZkYftqqnEX15h0NzCPLtOhgkt22pUq7HqE/nC4ed69dr1OZS48Q9VYerHIIfr2PWaSxA7FdDTOuWQBxCgX/wamtDvNCIqor04lqmc0OquwS5pSsf1KdpBYk1GfNsvn19Iltk2KIqA5dFfR5h9YS9PAS+CukNiyUcmZYiqD7oqXlDtK7cv5rMJmIAwaK/+5/0t/AShHVpXQ/rMjLI57w6oE6cgHtAnxFhRAtKd/7sVZxooVO55k5Rf0XuVe1TuYyTOlPtXvXWu9Vzt2WFis704bPc4C/qWC5FbFmEII8xa6c4aBzqbfgRu2C5YqZEp3WswicvA0NS1ziLaSkL4PiC3dIA7FXj7k6jdCRNs6wnUVivvQ2EeiS/ITif/exADhwofisT+odlWfZ8jo0x1Gzs9kTLDleeBR5R8NNaBdDjeieILM1TrgpM3Hx34PjixrgsgIDYmUecb/8DXGozj32R+8IarZzewSJN4hjSrcMMTUSYPmfyBNgZDEJ0331xLO0XvpucKxGIpwQnnqOGzF+wVZfHaZhMZTes4MP0owxI4jzFWYDi2wdI0FSEZ7zRw8H+pnqXrW0mswJ0fF/smvxCmxpz3fBYYytrY2FnsvDUwsc04SHgmPGajP0yolB8+c/u6ilCqx9w2RDicqB102yOjxqm4huXPJwHwGTyYTvkVAsTWZN3prVhYpZl3asOnZZ8KkMbcte91Wf4Eoqe/6nM+Ved5PdyH1VaSndT/kM0aUWutlvRt7a5ELb0cpsnirFi0T14geQ0KAEm0DvsvSdsK61gPHDH3IKlXCQXUylrD4IBoecpFB3IjtuKQEN0FrQDsnyV/rLyiYzjFnXVQFe7Eh8KuwNm7GCs9/CxuMmDA3amtlZCpFV+t7BWqRahagtnlB0yRQ9W9uO3zqqTTAVpSAj13iWkpSTMLqepzVLtAHCQgf4dvszuftRS/okJzTo1Yltoa481lVoy2kE2GLgfk6BRLSEDHGW3VW3FN0m16mBjaJmeHlnbuxFlAaqfoylxsh90j704P4unXZYbTd0zh/HUm3vCBpSwJK7PobT2d7JOP3j4WKqaICXRH/NhhJax9umPjdTyYoB36fxVjAlVuoZGb/BM 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)(366016)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: anH3BaX95n+YunZyOJLTS13rK9RN4iwiAlarRsthWjLTnhKfCeUUKcDrXyoyqcse7/swVHyr1JRSTln/wlXbo77nPyNKqEZ5sqEVR+edl8qYCEGgbvpS7r5B0WhRKV9EZrXeB72AFBa+rOg2JoM5cFeNVwDHLokCmymJ7sf9Y1wqw8VXkcCKDuJKqFVWfdL39HPspy43NYOJkyp9SkRT/M6aJi+sRz+Y5tC5X/GK1RG4rUEe3w2hYPV7YZEnB5ModjyvOc/T7XSfA0HUat6jfWsMTL4FmsxPOQ2ht71spIJvqt3NqfO8nnl/De9q6WY1hKdFP3iomxBQD0jLDWQY51XA+QW2gs+uoaT0ESJBuUUPHX+08VaVBIxPyN9Lci7GjO0gvJmu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zELwBiYyejId+6n8CUu9qvLgos5bMus1NhigGGUL3DiO6rnOuiLrZDHGVqAR9+DLvc0k+4ZXrnk0zy735vLZGuKZExC4NYmE4LYcS3F0aO3A9evV8MamRs2wYPpZ3F9rK6NkvCXfCpyRdG+nEaNjg+YYJNg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VWtM9K/w4/XIF8sL0WBxH28P4WAfdB4e0RtytF4EEf2n72oIjzaqPQLgGP23zCo3cbmz7YXtosJ+CFJK/xvRyXdcWxX8Z1AB7TCOJ0ViDGl0R+DqoDzXF6C0Dm2ItDYJzkYNlQcyNuygp/ErTqkZURO7NBzZ/1S8x69lxO5JH0B1+PB7sbkiFMhK+7Hs1hu6lfaGK2rEGoBIVwEWn47y90Nr19Q6R+e2cvlJ0iGxtkh5gU+b37Dvce/H8CMisQjyJEd90rmAAEpphuoqSj83nkQKDlzS7jJxY1U4lPWEILCBmFw8jU3mD9hykPsL4Ifl6vCqHfrmeHYgropHX6Huf65NdWtPjRy9oAHjqNzNL8vZgNFEjLR3JeiTdAIPVxcQKV5eJdPpA3SccuXsAFxCfS9sMKHGrvwuftUqdLLGqIpHnlY6+LkaQTtRAxPxDFaebvmfJcnSPJVReYG/0nnUdY1luRBlIxVT1x5etEUKMw8hapMycMkQtL/kwzfYf2OGvsVEQenCwAQLCgl+6iV8BUVK6+DwamQE/tyjGtvViT/UfGNaxqJzIwVqK6qGhHjjIRrCQZx416iCl6pMDoQTWBRp7BL4m3zPL1lkT7zgzxg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: baeaa560-0d5c-44e4-9d41-08dd3eea6ad0 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3374.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2025 15:51:09.2992 (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: 5/gv3Eui7FGlaFoZuUuFBYwBBOLNvCYYYQ9sLZz+HfNaq1aBxH6Oh9voHtSJgGXBBwBiE0enNm2Jx4lq0xDc2LbRhGrQ3Pc6KKZ+X5p7+Ew= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR10MB6339 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-27_07,2025-01-27_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-2501270126 X-Proofpoint-ORIG-GUID: sFFNWuC20WDiGL3ev0qE1q22MbGcreLF X-Proofpoint-GUID: sFFNWuC20WDiGL3ev0qE1q22MbGcreLF X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 3AE2F1A0007 X-Stat-Signature: nd56xrexa1rbrof7y9kip7s1963zjnw3 X-HE-Tag: 1737993076-256613 X-HE-Meta: U2FsdGVkX1++qebDFHRMhDI5iKW0O9bOg88zdJytdrIrMrD8Fa4o0eE+aBafrmPHJBV1UdzUALwFeic7JzPVP+QgqJHzBSnFguKMwEDgWc1i2tdHoJg2Mm7PhbICE1uMu0W8NeM9PyFWXNzf8Xjy7poBX3qDnuorIvSaZzyGNTFz1SOPAuBaPY5no4nAr10u5HH0oNZNhtcH1SoJcGkIDvOOJY6Q2TwuHihcTdTJCL012uYrKNclw80E86Gb26Zp4e6/2o4s+AcrmJe86SIM2brKRMw9leqOOJY8caZlE2RbNfDpoG8njjksaU+DPpoQ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RSY8F2YPPuwKIbLacf3ahJ6w7Xyc4bNQppf9xkPA58SLgX5QEveaNcVb7o+QVbhqPdhXls54nkCGkTBBZQZP8+cIWWjkqNsPpYPQV3c3ZHscQlPpL6hO6OsPQYvzKHeFgldS1nSxbFp7Slz09iSi+ED9Hbzm9IrMlqW5FXJyHq/97iRO+5ajwC/RA9jqNyndJGJEyUvDtgGQ= 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_FLAG_ADJUST_MIDDLE_START and __VMG_FLAG_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/vma.c | 53 ++++++++++++++++++++++++++++++++--------------------- mm/vma.h | 14 ++++++++++++-- 2 files changed, 44 insertions(+), 23 deletions(-) diff --git a/mm/vma.c b/mm/vma.c index 955c5ebd5739..e78d65de734b 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -633,29 +633,45 @@ 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; + unsigned long flags = vmg->merge_flags; + 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 (flags & __VMG_FLAG_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 (flags & __VMG_FLAG_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->merge_flags & __VMG_FLAG_REMOVE_MIDDLE) + if (flags & __VMG_FLAG_REMOVE_MIDDLE) remove = vmg->middle; if (vmg->merge_flags & __VMG_FLAG_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 && @@ -739,7 +755,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_will_delete_middle, merge_will_delete_next; bool merge_left, merge_right, merge_both; @@ -860,11 +875,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 (!merge_will_delete_middle) - adj_start = vmg->end - middle->vm_start; + vmg->merge_flags |= __VMG_FLAG_ADJUST_MIDDLE_START; err = dup_anon_vma(prev, middle, &anon_dup); } else { /* merge_right */ @@ -893,12 +905,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->merge_flags |= __VMG_FLAG_ADJUST_NEXT_START; 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); @@ -912,7 +923,7 @@ static __must_check struct vm_area_struct *vma_merge_existing_range( if (merge_will_delete_next) vmg->merge_flags |= __VMG_FLAG_REMOVE_NEXT; - res = commit_merge(vmg, adj_start); + res = commit_merge(vmg); if (!res) { if (anon_dup) unlink_anon_vmas(anon_dup); @@ -1087,7 +1098,7 @@ int vma_expand(struct vma_merge_struct *vmg) if (remove_next) vmg->merge_flags |= __VMG_FLAG_REMOVE_NEXT; - if (!commit_merge(vmg, 0)) + if (!commit_merge(vmg)) goto nomem; return 0; diff --git a/mm/vma.h b/mm/vma.h index ffbfefb9a83d..ddf567359880 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -67,16 +67,26 @@ enum vma_merge_flags { * at the gap. */ VMG_FLAG_JUST_EXPAND = 1 << 0, + /* + * Internal flag indicating the merge increases vmg->middle->vm_start + * (and thereby, vmg->prev->vm_end). + */ + __VMG_FLAG_ADJUST_MIDDLE_START = 1 << 1, + /* + * Internal flag indicating the merge decreases vmg->next->vm_start + * (and thereby, vmg->middle->vm_end). + */ + __VMG_FLAG_ADJUST_NEXT_START = 1 << 2, /* * Internal flag used during the merge operation to indicate we will * remove vmg->middle. */ - __VMG_FLAG_REMOVE_MIDDLE = 1 << 1, + __VMG_FLAG_REMOVE_MIDDLE = 1 << 3, /* * Internal flag used during the merge operationr to indicate we will * remove vmg->next. */ - __VMG_FLAG_REMOVE_NEXT = 1 << 2, + __VMG_FLAG_REMOVE_NEXT = 1 << 4, }; /*