From patchwork Thu Oct 17 14:31:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13840120 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 58DC0D374A2 for ; Thu, 17 Oct 2024 14:32:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F38C6B0088; Thu, 17 Oct 2024 10:32:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97DDE6B008A; Thu, 17 Oct 2024 10:32:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77FB66B0092; Thu, 17 Oct 2024 10:32:05 -0400 (EDT) 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 38F326B008A for ; Thu, 17 Oct 2024 10:32:05 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 240DE1A1429 for ; Thu, 17 Oct 2024 14:31:45 +0000 (UTC) X-FDA: 82683333306.09.B35C8DE Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf19.hostedemail.com (Postfix) with ESMTP id 4F0381A0017 for ; Thu, 17 Oct 2024 14:31:49 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=XYNv3C3u; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cu89zcW4; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf19.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@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=1729175375; 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=o0Sny/sBRVs8IfCJ/rDpvACzizqPjudQsF2MltKVY2U=; b=vHzitCDp+uwomGnVuvrOpYVyUWy/u9jiGY/IZSW/iJn7BrQ35s8vGg0SxnGSplruK0joFR zUScs5JDUlSO9/Ne27EE+VN6zdmcjnogGm2yWvym3qKWDZysg+KdFXD26HGHbbc8qx6eOv i5JRT9BmjAb7p5zKeFX+wUae9nxlLLI= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729175375; a=rsa-sha256; cv=pass; b=EF74v3COQRdrXSxAon8OzGbbMYeMmYExDN0RfMlnbWjJyQu3CMpXEdoBB7g3hL0/rt6FlE ofH/+cz/Vizz4TVSWc2qgXi1nwI2hLteuTYjRhCkThm0vuX0e70A5J9HeXozYkg7XOyUhs rU0gydw+9I1JKUTD7rJ7PuzLoxo35AQ= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=XYNv3C3u; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cu89zcW4; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf19.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HEBejH013076; Thu, 17 Oct 2024 14:31: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=o0Sny/sBRVs8IfCJ/rDpvACzizqPjudQsF2MltKVY2U=; b= XYNv3C3u++t2d4f6UZ/XVDd6lPqEcYCc4rjXULqI6OnBEhYolX+AcSV8VcEUQmWR zkfr15i0RS2xy8rBDBP59W6AbrLYtaDoNaWWC6whr3cmWmJYVt9bDC7ICxZUpDIh M2Gy0b3QZfTwQx2/UXYrwTaI1m5PfVkzdKKkS7DnaKPTeRGj0U15N7QM3NupYHt7 Yue8wyYr06IEYq34yYqJbpE4g9EOubNZ8vEBEPYORRfn4FnoxTbxwxZ1oHt5Xxxi yqzvxsjmByxSvaqryriF2YzPsaXEf4hAhbUf6PRehHh8em5nGhKnK6HqWwmQ5neo kP6yPtf7A3vn13hidmbKFQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427h5cpyau-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 14:31:58 +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 49HDDD4C013980; Thu, 17 Oct 2024 14:31:57 GMT Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04lp2169.outbound.protection.outlook.com [104.47.73.169]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 427fja9w2p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 14:31:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dTBSVYR76xHzQ69XM1racTt3XjQPlSOGUsUGcYnKMAJr7nL6UNWN0Pdhjtf3NILYqBPh5bt2puNz9N7kOh1VF0W2JEBb7hwRHrEbf1vDWvTFs7DZKAm/3ZrdC5PtK715D+GD78o9YGDBF5/Oay6Rz1kgp39hj5/Z24SDKcDkFW4qyBg3tokPLpNG5hgN7cA44jb/wv8H6J+VzMZRNpOCUv0qCkYMLR/0Y+ty9AZ+Iv7uQEQIb1gnzr2hMPtkkumCV0d2qn9Yzp/DFU/Hgpqk3zKGaT7FlRiGXxli4cDVENw23kj62JEAIaCOGf8qUXRQC5+eKTT5jq70BwjF8SBHvA== 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=o0Sny/sBRVs8IfCJ/rDpvACzizqPjudQsF2MltKVY2U=; b=d0x9hZC9vXzYyxla1w5uMTETHhsxMknSR/edsdfwDWWS5ADDpLBmY2ldSwbdk4CNiI7Pm07CVgaBN7E5yI17QNOMohAbSZ9NWTFUMNeJrAqoO+fmjWxar9ux1aKcL9LIi/a4UfBeOdy0jnvZ6Dg78NW9ZperpWhDkZ7jfVnZrQ6pPqzYwSiy3Relxb/bjFq8OPTs1MDFHCuFhVpvAQNwLkkkPsaQiRKN7Hxlip2VTTn4M19m1baWGpcRG8/hpaTsKQA5pNaQFcTt1nLTEnf5YWFre56QERBHfYsatAiZ6Q0v62s4R7oJjIqgVS40Li5Lrs7Pyr2ciLXV+vVkFY6SmQ== 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=o0Sny/sBRVs8IfCJ/rDpvACzizqPjudQsF2MltKVY2U=; b=Cu89zcW484cIMjPK7TKqo4+ZSDeom3OGxdpBFWkzCT7harTja8st8vXJcC/JckVFatoWqUk1dXi0k76fqk7ZU5GoAsSWGX5+O2eXywbLSmrc6jVSxCEWYXbyvc7lRXZcn4d6o8s8OuTSm8HhyPa6BmCgaxkf1J4wF2Y9COSCARw= Received: from SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) by DM6PR10MB4140.namprd10.prod.outlook.com (2603:10b6:5:21b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.21; Thu, 17 Oct 2024 14:31:54 +0000 Received: from SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e]) by SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e%5]) with mapi id 15.20.8069.016; Thu, 17 Oct 2024 14:31:54 +0000 From: Lorenzo Stoakes To: Andrew Morton Cc: "Liam R . Howlett" , Vlastimil Babka , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oliver Sang Subject: [PATCH hotfix 6.12 1/2] mm/vma: add expand-only VMA merge mode and optimise do_brk_flags() Date: Thu, 17 Oct 2024 15:31:45 +0100 Message-ID: <4e65d4395e5841c5acf8470dbcb714016364fd39.1729174352.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: References: X-ClientProxiedBy: LO4P265CA0215.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:33a::15) To SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5613:EE_|DM6PR10MB4140:EE_ X-MS-Office365-Filtering-Correlation-Id: 3d3bd83f-15ea-4a0e-e3c3-08dceeb8726e 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: +ZneJuyNL39kPT94ZFk4oV/oY+3n5pIMuoUL265eTDt9tV/GTqcwIzx7NgPe+9rUd//1HaQzQmOZ6R8slzg3+Tun0S2TT5GTH16ONN5glvL8UIEvMySwBc+xGkmVUfPJ0Noisk34+Byg41NOqxAbiQGugq/SVjhzF+kxXqcwlGhCqEhsLpDdyT+kopDxCr1LQokA6fvwRMcoIzrZ9dXC5hj/Q178ku8CgLBp7/+wWFV60E10pTELnTohcow5XdVAzFNyvCP/vE+AdQkufdd/pOvQFbuAYKlRt6GKRsCfRqGaNvZe8BO4QvEnrnATN0bDARqbBVkKQeZ0EE23DDtdTO/Pp/7rGckgCS4YBtKh/zCNG3dN+mtZ6ArcaAaIYXvKAiH2WNX4lew7TM+5K5zZLho+ms69mKh9eWjh7vGndp6EcYCYkIHYcXV4MGl+rTe1WEIGHLYX5b2cNWdPGad8zrNvK2szqm7zzkF65QmvIGvSrKL/BUp/kBrTQZlBnP+JWUeig+F1H7LicSiR9Lqrbu5eSoG6wv8hVasfeXxDpNIa8FtQQPb2cwEafXfHIZ4nFFtvkoWtX6JVuc1iK7Vji6arsYIWJY09wLEYuDbmCDsiZ0wHZ9pCQI+yQ5rawP8ZAMnNu8eBOIyM47Lpx4gfeWA8W26UsoY2AfKTa2H4McgHiRkhgPceS/+o2QomM6x0ou09v3IJ4pvMA8skYI4Cx2ik1n4R2HfDUy29tzrcnsQHhh+yRcuHPnIxEVwfKwYpVyrkTX7L3lLxkzkUYwjjr8/K/3JNDfPJw7m2SRiD3gjrbjoAQ4bZ8UYq9cUzYFZgG59etnBRywO7umk0W9WX4YcsvmNwYfsu6xZUOvgq87oeLPVYVU5b/fezb9b63PZ2yRoxaCR8KriOayFX1nTq+75iJ08lNtaPYSk5aqYBxt/aWqk/0RB+bZ0dIJ5mmTIPKRuFrFvdxnSLxXLJPBpJKNxTmXJ1xzSZ23gwzuwGVXL/xdjyibCg0lyyORoe2BPRV9mPnzUIv2JEKdoYUlkiH9FYxirT0q+UFfv85zodlRPJ86LyKAdhF6E5wt43HqeOFEhoCTUdgru64QrsAl8/L6eFIXJLdBqrmtTr8JnykNNMc3vuDghQoC/XP+cpogHo8mW0pVCcBJiTr9b8l0HOBuQp6v6+VcuM/tFuLgi9YDebr1ucrxroo5Je3ykXwuWrPGwYjKuqUG/iEboJlKmWW7cQmuwpFNnI8VOnGEN81TaZ1lTP2ezCM4OSfFU7V/bNUcWUcLo5M+NEwdr22zcYzGuUK3EorPNjitCE3aW2iUKjAWhhqAubg2uoC+fIMzhx 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: d1/LtrJqAaALZqqPU8opouKpSW+YsP2JDGGf9qi0M1wOWsN2BQrcIL7IgL9SJgf/BiY0UjD61/zz0WDdJHBNqax1FHPeYQXuaaqbX9/2ERxFX612LSnu/1YQXYtbBgN+td2au6NrS21gMaZQvLenf2Ajxx6XjsEd7fF0k3DArE2VLwikpQhuVVaT3SQc+C/cxuClukjSMYjBxVFuFKbiYFJfFtlmRmza+Gq3hhH3wpV1EAiQy5X71RR2soJv3e8I6t2iFraxC82484CMO+6OLZMkM5jf9CQzPZZXCQ5FRpeNXEs+OarRPvZV+BjU7b8/lvWRjrYliuwBYXMche9CDSku8tBz+K+Pm8mtH+T2JTt/w51zL1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xOmN856SI7L1SoYmyZQIg50RRHAyHVauypCipwgD+wDP1CGWewmz0QL588nPcbXXYcyKo5LOiRqxRKd9p0m/sCUmxY6Offbn5YHdyRLgVVYdJdm0FmSGaesc7BTTeruSJ7aaOShnvxyYf4pw1iumuZ+rzRS4N94estIDePu7KiHeqfbIWNekQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: IY7GPiIXKK9A/67wy4CfYMBU3uAG1Ln4u3w6v5jnBrPLjRFXaCljXStvvQZ2uqYpRUAlGO+ggi8IV0xQ9EJVeEGjavmwU4dt24kX1fH6z2M1RL//2TLZWit5Fhf2z3PCzB69utkQQ3DzQqMQDRz6JSt9xx/vyu3daJ8nVSJDBUHVZNclExtbHO8UbsigdgURkxORiWbNl4POG5zlUkYJz1kgHr8iC6fBhTp5Bj4LqEViI0K2p8pO4Qs+0UF+DjBydEGnZpCFNpNaVH3hwREC8L+m8boy7DP1hSIAWnKz0aMPp2nl7qBuVs6RkR1jYFP+RWO+HG8QelpNS9qLavEvRdouiLH2PcVtVbLa95GgBwp4E46Mt2QIzznALsnR0/hq2aQUStlv6ezA07buX5prE2BCwSaZtAKF+hxtrvdYcTOQH63P60QNMOuMueeSJWwHcs2o6uDy1njud/zNa3X58mM7pW8TZpunKe8R1AieyYny2FHDhY2KUljIPIKHWzK01ZCbPe3FYMnFfZ+T+Gl+eMlpZa1DeMird92H/fx3yA7BlFB94N2DZWubxREUi3ZpvBpsr2mWUIKoECTTtXrKMnHzdnC1turmWRovIT7J4mM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d3bd83f-15ea-4a0e-e3c3-08dceeb8726e X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5613.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 14:31:54.3393 (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: TARtuWYx3ogJO0cWsOqN23nC4beLlu+yK4WkziNTw6+abjMcIY2bsI5mJERZyr4AHNDW6Fp7rzOrbNCXJMszMvZIlvJvUIshEijGuC4Tjwk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4140 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170100 X-Proofpoint-ORIG-GUID: eny0VBzDcEIIsEfTlyDRfD6gVkwMAgZq X-Proofpoint-GUID: eny0VBzDcEIIsEfTlyDRfD6gVkwMAgZq X-Stat-Signature: e7zhw8otym1qb3a9omgp3oqfndch3g8y X-Rspamd-Queue-Id: 4F0381A0017 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1729175509-203094 X-HE-Meta: U2FsdGVkX195NxEPlgeFr84iReixMNt3d64L+wav5M5vj5ipyWES0kegcMJ+fsFfbbJqlXo+Cg6oZXkV9Pp5u/ztbJY9oxnS3UXqYUsxpHFTy1sKRxjB6fPbeSl7kniEGk3NHi+TX9YHJAEKac/qOvlzxmhcKphy0zHsFpszPH+0YSx0/A2kEI7WfTyj3LfrMa7zDMdHSZJg+nndvZyiBrpQ7XKuGInsbSjF+VRixtPrsp2+SA9KdlcD4ijoHua/occEQpjz/UxYMXU6E+KLir6QdZkujs3MMvuA1HPDmWiZyKa5IWUhxtnzlNRvqdfjDt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eo8DchIj6sYVJmR/jLmR0wc3oy3CzwGh6lxLbBUJQKcQQMTMcW2RP4LwbcoI70YAPjs2udDP7YZ2l3VQ8tmSfs6iV2ZXxbJLayR+H62T5PA8EpkoqY4PVItGkBjrk+z4RiQEA5ky/kGjBYnCTO/MmA1flrZFM8sU6sWzrTm1wN5Ze/87wbNakJ78v2fBImJfQmop57IBc= 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: We know in advance that do_brk_flags() wants only to perform a VMA expansion (if the prior VMA is compatible), and that we assume no mergeable VMA follows it. These are the semantics of this function prior to the recent rewrite of the VMA merging logic, however we are now doing more work than necessary - positioning the VMA iterator at the prior VMA and performing tasks that are not required. Add a new field to the vmg struct to permit merge flags and add a new merge flag VMG_FLAG_JUST_EXPAND which implies this behaviour, and have do_brk_flags() use this. This fixes a reported performance regression in a brk() benchmarking suite. Reported-by: kernel test robot Closes: https://lore.kernel.org/linux-mm/202409301043.629bea78-oliver.sang@intel.com Fixes: cacded5e42b9 ("mm: avoid using vma_merge() for new VMAs") Signed-off-by: Lorenzo Stoakes Reviewed-by: Liam R. Howlett --- mm/mmap.c | 3 ++- mm/vma.c | 23 +++++++++++++++-------- mm/vma.h | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 9 deletions(-) -- 2.46.2 diff --git a/mm/mmap.c b/mm/mmap.c index dd4b35a25aeb..4a13d9f138f6 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1744,7 +1744,8 @@ static int do_brk_flags(struct vma_iterator *vmi, struct vm_area_struct *vma, VMG_STATE(vmg, mm, vmi, addr, addr + len, flags, PHYS_PFN(addr)); vmg.prev = vma; - vma_iter_next_range(vmi); + /* vmi is positioned at prev, which this mode expects. */ + vmg.merge_flags = VMG_FLAG_JUST_EXPAND; if (vma_merge_new_range(&vmg)) goto out; diff --git a/mm/vma.c b/mm/vma.c index 4737afcb064c..b21ffec33f8e 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -917,6 +917,7 @@ struct vm_area_struct *vma_merge_new_range(struct vma_merge_struct *vmg) pgoff_t pgoff = vmg->pgoff; pgoff_t pglen = PHYS_PFN(end - start); bool can_merge_left, can_merge_right; + bool just_expand = vmg->merge_flags & VMG_FLAG_JUST_EXPAND; mmap_assert_write_locked(vmg->mm); VM_WARN_ON(vmg->vma); @@ -930,7 +931,7 @@ struct vm_area_struct *vma_merge_new_range(struct vma_merge_struct *vmg) return NULL; can_merge_left = can_vma_merge_left(vmg); - can_merge_right = can_vma_merge_right(vmg, can_merge_left); + can_merge_right = !just_expand && can_vma_merge_right(vmg, can_merge_left); /* If we can merge with the next VMA, adjust vmg accordingly. */ if (can_merge_right) { @@ -953,7 +954,11 @@ struct vm_area_struct *vma_merge_new_range(struct vma_merge_struct *vmg) if (can_merge_right && !can_merge_remove_vma(next)) vmg->end = end; - vma_prev(vmg->vmi); /* Equivalent to going to the previous range */ + /* In expand-only case we are already positioned at prev. */ + if (!just_expand) { + /* Equivalent to going to the previous range. */ + vma_prev(vmg->vmi); + } } /* @@ -967,12 +972,14 @@ struct vm_area_struct *vma_merge_new_range(struct vma_merge_struct *vmg) } /* If expansion failed, reset state. Allows us to retry merge later. */ - vmg->vma = NULL; - vmg->start = start; - vmg->end = end; - vmg->pgoff = pgoff; - if (vmg->vma == prev) - vma_iter_set(vmg->vmi, start); + if (!just_expand) { + vmg->vma = NULL; + vmg->start = start; + vmg->end = end; + vmg->pgoff = pgoff; + if (vmg->vma == prev) + vma_iter_set(vmg->vmi, start); + } return NULL; } diff --git a/mm/vma.h b/mm/vma.h index 819f994cf727..8c6ecc0dfbf6 100644 --- a/mm/vma.h +++ b/mm/vma.h @@ -59,6 +59,17 @@ enum vma_merge_state { VMA_MERGE_SUCCESS, }; +enum vma_merge_flags { + VMG_FLAG_DEFAULT = 0, + /* + * If we can expand, simply do so. We know there is nothing to merge to + * the right. Does not reset state upon failure to merge. The VMA + * iterator is assumed to be positioned at the previous VMA, rather than + * at the gap. + */ + VMG_FLAG_JUST_EXPAND = 1 << 0, +}; + /* Represents a VMA merge operation. */ struct vma_merge_struct { struct mm_struct *mm; @@ -75,6 +86,7 @@ struct vma_merge_struct { struct mempolicy *policy; struct vm_userfaultfd_ctx uffd_ctx; struct anon_vma_name *anon_name; + enum vma_merge_flags merge_flags; enum vma_merge_state state; }; @@ -99,6 +111,7 @@ static inline pgoff_t vma_pgoff_offset(struct vm_area_struct *vma, .flags = flags_, \ .pgoff = pgoff_, \ .state = VMA_MERGE_START, \ + .merge_flags = VMG_FLAG_DEFAULT, \ } #define VMG_VMA_STATE(name, vmi_, prev_, vma_, start_, end_) \ @@ -118,6 +131,7 @@ static inline pgoff_t vma_pgoff_offset(struct vm_area_struct *vma, .uffd_ctx = vma_->vm_userfaultfd_ctx, \ .anon_name = anon_vma_name(vma_), \ .state = VMA_MERGE_START, \ + .merge_flags = VMG_FLAG_DEFAULT, \ } #ifdef CONFIG_DEBUG_VM_MAPLE_TREE From patchwork Thu Oct 17 14:31:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13840119 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 AAD78D374A1 for ; Thu, 17 Oct 2024 14:32:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 27D596B008A; Thu, 17 Oct 2024 10:32:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1680A6B008C; Thu, 17 Oct 2024 10:32:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E88356B0092; Thu, 17 Oct 2024 10:32:08 -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 C6CB56B008A for ; Thu, 17 Oct 2024 10:32:08 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 1506A1614CB for ; Thu, 17 Oct 2024 14:31:56 +0000 (UTC) X-FDA: 82683333474.01.BD626AC Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf02.hostedemail.com (Postfix) with ESMTP id C5FBD80012 for ; Thu, 17 Oct 2024 14:31:45 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=CPTQCCjn; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ut6uA1cE; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf02.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729175406; a=rsa-sha256; cv=pass; b=sX18o9GDfooZSy5kQSAu8q/1giyThlm+9YhTu4KpvxMm2eb5CwJRjpamSKzvVwR9QqsqcX tKXMK6+pI8911/JQhY7WDgXPdE9TtQc7M+pIjSjEWrtg0E5AzB5wZMcDDvRmlTFLeE28NR f3PCvZf7eitNKs4DW7CoyPZU+3RSC9k= ARC-Authentication-Results: i=2; imf02.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=CPTQCCjn; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ut6uA1cE; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf02.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729175406; 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=1Zdr+8oUZdKWzec5VqzUsqQsiYTNGhLqf5HOxhs17XU=; b=W884tT1l24RCDbZ/r49Og+B9eul/NdXBLfzoH/eELhGYGEIscGLBVs/ZwNUfta20uex8lW aHQcc0maEkN1Yewnf0uN8iyGvKxaMt7XhVe8cErSDBFklpeDo0G9ABrKez9CCOfo2kJb31 OioAB+8Qmn6I+t6iMZKp4eTZrNDqV1E= 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 49HEBh6H024154; Thu, 17 Oct 2024 14:32:01 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=1Zdr+8oUZdKWzec5VqzUsqQsiYTNGhLqf5HOxhs17XU=; b= CPTQCCjna0ru/lsgCMOsHe3nVwk/2K71AiVMEAOmxzRUfFw1yJsRc9dfMdGqLM8D 4DtLMmZT+8zwxrI7DMyKc79dNoSJk+Xn/C6ZDFdBDmgnImRqAe+f/6WJnX+l0BNI yJhBtsqJJ3sEBQMxAd382aSj1scNAeCjbPH4XZDwUFOda6cHUK5Lu8u/bbx0O+o5 vh3iIBO3byDcOvHFFzXmOeApWM1Vhjnbby/QaJdwc+fuUCtO4EW6IdfLjfqcrv/s 91ztWFIAvUxqzNT7Mox+ZwKXQg7424u7rJf5SVa9Ev0nUQBklOBvBnTxbkLquo7N 9PFDRQnU8gcK1L7i8nYMHw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427h09p17r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 14:32:00 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HDC80A026424; Thu, 17 Oct 2024 14:32:00 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2042.outbound.protection.outlook.com [104.47.57.42]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 427fjaak4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 14:31:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rnWgNMEgcWwWwIj1LbHZS5q1CcvKwSgrDsF2EnrR/K1epZRlm1m9UFcQ0Lsv4/KKlHJ70WDnv6Wvm2wdAZgco9vxc9VS9qCy7gpe9foHcM59HIalibkaiMaFYrb2zmm3Ssm/NUPZsDowis9G5ffD7Y9OPxMINumkuRTzykH4hK9xUmUEACt2CIUTEkrnF1WiSJOAH0yXoFR6agytCOSVX8W2fY8SRFki8GZ4j/SA814d7wA9QxPn3G6+CsX7bvVyQTLdr8z0fGNBHhjXJFJVpUrYSIXIAlfCSM0U556+Zg4hNvgDGYihZWA3wjb7mJUc2mDVYk/lne1vyMm8O7nccg== 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=1Zdr+8oUZdKWzec5VqzUsqQsiYTNGhLqf5HOxhs17XU=; b=aXB1fA4NRmJur7793LBduUuNpNGB/cKM25eNy0CtPmZaRGO232a6a2TWmV+1q7UX8g6ySTuH/sAJRuZa7gl4iJwnFi8Xw6lLGPXTK7EzvqLiRuhcT8nupDkhuOLhVKVos3nSBlwYqv7sxfzzVAYPn1aU8N7hQQGrn69sliRBfn+uRGnB3G7mCvBPsAGtQDOtf8x8G866m5Xu7Od0LOjfEojNaKwAii1mMcU/D9u31dI0BqQ1ykzD9tDyQywvwh3UirnWF+CDySFJAMaPfLotgWbNjvGsZPDw8cgDd2aMvw/hljtakOlAhLyk8OFj9yvF+dT5vFDfPmmGazUsR1/dIQ== 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=1Zdr+8oUZdKWzec5VqzUsqQsiYTNGhLqf5HOxhs17XU=; b=ut6uA1cE8k5JRsUy0ig406MR7jDxemafnOwjsgYuTNJsQ6g9r5OPY337eM+hn2W08GHjRa/ECo02GjYTsZX2SFIuUgkyJn2wObg8R2jOXEUyB3IbK7zxtX/m3xYWlk744OWarX4mCBsj8ighnSN+1KTDkwi57H/+pdzSDHMlQ1w= Received: from SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) by PH7PR10MB7056.namprd10.prod.outlook.com (2603:10b6:510:275::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17; Thu, 17 Oct 2024 14:31:57 +0000 Received: from SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e]) by SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e%5]) with mapi id 15.20.8069.016; Thu, 17 Oct 2024 14:31:57 +0000 From: Lorenzo Stoakes To: Andrew Morton Cc: "Liam R . Howlett" , Vlastimil Babka , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oliver Sang Subject: [PATCH hotfix 6.12 2/2] tools: testing: add expand-only mode VMA test Date: Thu, 17 Oct 2024 15:31:46 +0100 Message-ID: X-Mailer: git-send-email 2.46.2 In-Reply-To: References: X-ClientProxiedBy: LO2P123CA0083.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:138::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_|PH7PR10MB7056:EE_ X-MS-Office365-Filtering-Correlation-Id: a4783e4a-2511-4a15-7fcc-08dceeb8744a 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: VuGIrwMFQUQcku2ya0O7EHgiSBgfCudlJ1X/xUc/bLFDwyj6xFjlIbAuBaMeSP4zqxUPvz0NREiBVaYY/ZvHsqLB+YX3WTwukBvwwj9ZUV3uHyfL9CsLy1aoKGxN/lwGESSkJHtoSiWxM4j9bWqvLpmLrP/UWnQ6sXes9N03i9A0CmOft3EHY33Rwv4by4Vov4Uc1LRtKfZjYncC5So1aIGNlD65VdFehksVlLORmcGGu2mkgAbtjNWZXgW44/O3WbnDen0z1hnW4AdHTVddJpzqBS35Hv97KREe7h3+OeE5bC9bEkhZWMGr5NyKFAVrSv4hvz9tTVlp+pLhCtZC3a8MtbCaAmDjzf0kAQ5V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J0PR10MB5613.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: sWpUY9gxSdR61BK5krgeJceGteiFiF+/JlFYXYb+M7XaH8B7rkcu1ATSmqASgkbzuhgp6ktytZB6TadjD+plBGZEovyfg9XC+HtQOlh2+1c16GoNyM/L7cjFoLtMRHSzUA/nDFe5U6V9+QgoW7x39pIyoSZtL5krWc8iriqTEKHF5X8dwCh9I4m27UJnZBXqvg4BnV2u93AtM5I+tQsEIGh5OhdKm8Y4MdTQWAlu4EQJX6wSnt0c3FtrCMkdWtrulOcSQkeiLycomUl9E80FBb//F4SSxn500NyxHJAudgcQdCB4nYn1BPjx5m5+0ku/zzBS/qpzY5PbfKF5gGhDIG0sScdpdK8z/t5fbg3T698rxdK6d5yuAGZPe7pgfSK0YFMgPetBL4ZAvrefkBD658ie1vd3lE/kNwPLK3FtSqIPf3bwpkHsmlnv+9h4lVsz9moqFedhAcaDoKZ8xefLLdrFW8ZfFqZZp4Jj96O7UD4mafV5s28FmAWkSuNgKoLPHJKXEHEOHrEtNnnWbfkhyzNiSWJrZR5N83crpNmQbCCR5R9AuLAqi340iZlkCKn3E4o9Ay8wrLFCCLMCD2jmquAyZ02Sh/yk6f14wWzn8HMRehJjzCJ4McyV1kzYW4zMO9KbdRjfu3HeY8ydZ/we4aCF7WodEHG/1xXfZF5zZFcLjZkPpQO/8VliUq99PrdC2YHdAz2b06yYMzwbLgkxa5DyI+sGUy+YdeyXLlpLuMoTkOd5wIoR3xjoYWs9CGv0jLqYcD5kVv5VGUmdh+vI7/YrFMfYokH5tcBWFLMQpbtIHPdOakOSO/wZ19Eqrnwk6amyc92OAU1mKzIMZG1ZAzmRsVwFAMS3nk7FohYnm/ToJCLIKPdNTbGrgm1WiLNcDDgku/Bl7lFD65vguo/U9PWr7phDG0ksxn81v6lkYQL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gAW3N+yeQN+OKU3bjdWl1a1+vpzndp9JFtpKDn+HEerlFHQOjx+TfIMoUxCt2RhTPzkPv7ivJOS2S6KZSnBebQYCgIqNlfq4sWbkVymagcKIICrNAv9j+CQ7QuXapHFMc/GURTzS0SxBGRJL9osqWyxsmZ/xFwGEjBiEh/+PTSWuVLEdCAO2FqNtSnMkXX3Ssc/eJWQAUDtLBqvwJdGb0SSPWcJUdLWwyA6W5qpBQA3sgqRZ78BsCp9sRtZal+Z4FqfYYB+vmhiZZ8yrgeU4ct+7C2UeyzH2VyE/W9e5tXtk8UU4Faz+6aYzes= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4783e4a-2511-4a15-7fcc-08dceeb8744a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5613.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 14:31:57.3108 (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: vTeSJWU0E3a1geTU4XB2Sel1WMXcSd3sAnI430SXJMS2anauX6E5LLQyfvswIJijk15sb2quEfTc0EGZbyxXVQoK8JNxu2Uu5lclr4yzW4Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB7056 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_16,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170100 X-Proofpoint-GUID: tnx4CgAlnBt9qGqGDsV3X5XbYG082ZcW X-Proofpoint-ORIG-GUID: tnx4CgAlnBt9qGqGDsV3X5XbYG082ZcW X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C5FBD80012 X-Stat-Signature: tfmxuz5pitmucf4me5x9wi44fskjwioh X-Rspam-User: X-HE-Tag: 1729175505-257899 X-HE-Meta: U2FsdGVkX18zUVxF5uOU1zYz1wkq0kg3uFwR7i4xyVpom/5YhCSudqmsKUwJeKZ7eoEqhyqhYLQsWbtP3NAHrMoUFTEn4URZBDAOiV/KyPg+v/g0ABIOqkRBVo+Rt5B5WOMisFHoUJABw55ESfNjET9Ua8gQO5kb6fyo56nKkDHVM8tvW02+3jdKYMX6+HxXKKm18/7fKZ2NQPh/u9vb+oP2/DGJBKX05BP5se/IJY7Lxsx66t67bK4qejpPOwAkW3PxU5E5FJVpDXaXASq6AE/Nlme5OsuXeUxdqBg6lUyihTU05N7/azASnrPbwW4bQGvJacyToC0vHarddd8RDoe0Vp1VQMUhS+yDp+yfEd9Sfpvgx4NnVrH96i38OPVhvzVCDOVMXFg0zKai4MwAak1aNV8WIOEgpuQW2gsYTvusycgC7WSZFlJlFB2TVIheMrk1OeBAU7P9fhEO1bAFc6McmgGVzuStNBdsmIMSDQgzTZw9LQ434fwtApvPLtD0IrDNUWaDcj35Kz3nUk4S2ZwIPp6mk4yN5FFKvEstGEIR/tjB7QF5CCsooUl0PMNTks2by2fB26ZxqWogU7TwzBdjJZ27AJsl9IZj81rygbJQ6EqR6x44L0qVAZl2Q1k7/4Ub2jaunVC21z0WKDNWNQhj4gGjzwTHWweeJxOiHafnDpJKfBvxIhY+FsqCaUwCmISy5ChLr3YJ6TjXYqlA/0XXRoKuD5rdiE18Ytovy71XvD+0riUclf2EutfCSFEceWaOux4pIoaAZq3d4kNuvJ1IaUqQXV9vBGHSXrinLrV070E2IwLsiQGAkW8/TTcrTNd7yq/aNHhE8gXIycIbj2YEWLxNSHYy8/h/2Pj4n0aS8tGeHyaJRBtXz+zOj9JwpsXbOdhCiIMF9Mgjz1v2kbMncCPeFEw+wrA+wyn/enhB/XLwx3Ke3GH++umnKL3/vdA3/OU0rbqkzQiyxHQ kglpYnWU kRMM+8n1SnU11JiaZwecRZiQVxQV/4ZnPbgAq2+8v621cvb7nOufYBVYNpPFD+kge8A5fyHXIrQcb8V07BP7IKTdBg8kmv/eFNULyMDtNnV5Yvo0NXaHhmTqNO2dN1g6g1T7sWgTGw3Ff6YQyQPRbe2wItPPrvXR8fuhcM/4JqaBu2iJ0W0aIes9dmfVKZhll9xa++876m2HrFoEhcoOzhWruuQCquTs6q8OS6kc1fmJhtPlK+zc6+u+DYkNhzrkNT4HfxaN6BiMvVC0+SPexWfyOyHhjDoZ4/UjPg8SMPsEUKkgO27Nnf+UQlzOIaYYwrAHUIs0VHKHF+m2DUIg32OvXSsWKDaiPE+7ykBTY93SWaxOCj2g8VlC8lv3JuLogeQ/2Q6qeYihiXQ/ZhwwiOh5zFIhkkDRNHyoYKS9Ad3kEif+4ojo28Mijwyq5KL3LnhiK8fMUG/3CJqsl9cVoHWhYqvKPFQ1yna8mGq7n28oX/iA3IQ2rVR0hG42Wf5rhPH02 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: Add a test to assert that VMG_FLAG_JUST_EXPAND functions as expected - that is, when the VMA iterator is positioned at the previous VMA and no VMAs proceed it, we observe an expansion with all state as expected. Explicitly place a prior VMA that would otherwise fail this test if the mode were not enabled (as it would traverse to the previous-previous VMA). Signed-off-by: Lorenzo Stoakes --- tools/testing/vma/vma.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) -- 2.46.2 diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/vma.c index c53f220eb6cc..b33b47342d41 100644 --- a/tools/testing/vma/vma.c +++ b/tools/testing/vma/vma.c @@ -1522,6 +1522,45 @@ static bool test_copy_vma(void) return true; } +static bool test_expand_only_mode(void) +{ + unsigned long flags = VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE; + struct mm_struct mm = {}; + VMA_ITERATOR(vmi, &mm, 0); + struct vm_area_struct *vma_prev, *vma; + VMG_STATE(vmg, &mm, &vmi, 0x5000, 0x9000, flags, 5); + + /* + * Place a VMA prior to the one we're expanding so we assert that we do + * not erroneously try to traverse to the previous VMA even though we + * have, through the use of VMG_FLAG_JUST_EXPAND, indicated we do not + * need to do so. + */ + alloc_and_link_vma(&mm, 0, 0x2000, 0, flags); + + /* + * We will be positioned at the prev VMA, but looking to expand to + * 0x9000. + */ + vma_iter_set(&vmi, 0x3000); + vma_prev = alloc_and_link_vma(&mm, 0x3000, 0x5000, 3, flags); + vmg.prev = vma_prev; + vmg.merge_flags = VMG_FLAG_JUST_EXPAND; + + vma = vma_merge_new_range(&vmg); + ASSERT_NE(vma, NULL); + ASSERT_EQ(vma, vma_prev); + ASSERT_EQ(vmg.state, VMA_MERGE_SUCCESS); + ASSERT_EQ(vma->vm_start, 0x3000); + ASSERT_EQ(vma->vm_end, 0x9000); + ASSERT_EQ(vma->vm_pgoff, 3); + ASSERT_TRUE(vma_write_started(vma)); + ASSERT_EQ(vma_iter_addr(&vmi), 0x3000); + + cleanup_mm(&mm, &vmi); + return true; +} + int main(void) { int num_tests = 0, num_fail = 0; @@ -1553,6 +1592,7 @@ int main(void) TEST(vmi_prealloc_fail); TEST(merge_extend); TEST(copy_vma); + TEST(expand_only_mode); #undef TEST