From mboxrd@z Thu Jan 1 00:00:00 1970 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 86AD4C021B3 for ; Fri, 21 Feb 2025 16:12:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A7F7280014; Fri, 21 Feb 2025 11:12:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 14984280016; Fri, 21 Feb 2025 11:12:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDE14280019; Fri, 21 Feb 2025 11:12:43 -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 CCE67280016 for ; Fri, 21 Feb 2025 11:12:43 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7988D121742 for ; Fri, 21 Feb 2025 16:12:43 +0000 (UTC) X-FDA: 83144445006.21.5D83534 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf21.hostedemail.com (Postfix) with ESMTP id 19FA21C0010 for ; Fri, 21 Feb 2025 16:12:39 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=k8lwz0aC; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="uLAu3ez/"; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf21.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@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=1740154360; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dN2B5kbnK2i5AlX7Uu64A7nexo4CH2qnf8WomNzIHJI=; b=6+pqbWTTjoiaS/PQ4zlqFCHDql59UA38MUcnvb/ORB4+A3tcVSSa/gxc0zBm+5QOqNwJJd OuU5iM3XoFKzN5aZUKFE77SxQQXDh7ve9SgJvqX22lBDer6rnFaL9AtAX8ISDRmRq2XLHM +9n3SA5WZf2j2/DtmOtbtv9jDEO1fig= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1740154360; a=rsa-sha256; cv=pass; b=x7zi10hRRLDgJiE0P61iCo1X6vkf9zsjYyKsy8zWPvYXLyI2Hiq1SOqYi65wIzqnVjAYv7 WbFyrufjgS994w4LqR36hRA2ULp4gHdwVr51r43TthgbKvkf6axnxz7tzFgElWVy/dWvTk mAqRLuTwiQv/gBSEy5RsUtjpDOb52rc= ARC-Authentication-Results: i=2; imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=k8lwz0aC; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="uLAu3ez/"; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf21.hostedemail.com: domain of liam.howlett@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=liam.howlett@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51L8fbXb018086; Fri, 21 Feb 2025 16:12:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=corp-2023-11-20; bh=dN2B5kbnK2i5AlX7Uu 64A7nexo4CH2qnf8WomNzIHJI=; b=k8lwz0aCIj95KYkWiQqrLfsquJqaMMdyAy v8fi7Dhz7IZlZ3J3Cnvq2zqZLhoSv5CMBsrR6aHcblcnAkk15GBVHRDjSgy//KcF 9kuEEmokRsTu3qZjh0gc8KWi31SP5rYLjz0f1E+T0LacrTPBMVCRJ5SbuB9wgMQb 3g2AcWcAnZ+QJXrwdfaBIJFV/X/6c4J5ODcW+zLH+kcSb8Ae1JcgbeJSGHqIYSYx 26CkEBhLCwy/rwHAPy7d2rk1nk1QsgsbAfWumzfaUZ2VvATGQwvW7yvteCF/vXbL WJACK7kFRh/o5jPLNi0AnXNS0ikRddGG606qgxpCvhsPZp5a1M3Q== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44w00mxjmt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Feb 2025 16:12:23 +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 51LFivhf009785; Fri, 21 Feb 2025 16:12:22 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2045.outbound.protection.outlook.com [104.47.74.45]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 44w09fu9gy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Feb 2025 16:12:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qm9MXJz+EJdv1wWSlMp7Y5FrEdPL8vTOr8iCQemTCd7Ux9CjHrVre/Pl/mcE1HXgmWWT8u4UK6Pv0kzc76hrGcwQIUHQcUN09iNTzPALtAzRi7BZj7wmcJPDgfh3zIoNn4EsJTII/4Lsc5rZ7pR/rNXxBVxBpBEtQ4LRfscwyCJHwzdLbcZas9LF/CDZqarGdpEDmQ9qwHSy5TiAkdnf+He9Lt7JYr6aSsVqTQlxK/7wGcCEAcdRiwZ/ccAlNzKffij/c9kT30UZqcxVTeWrN3j+avfiO4UY1SM0FY0qp9yJpceIKKgCpbG2LbJ+5ixXpHgazE3fDndo0WXlauKLzQ== 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=dN2B5kbnK2i5AlX7Uu64A7nexo4CH2qnf8WomNzIHJI=; b=eguIm+K0Y13k3Df6aTTPNr+uGkeRX+YhUqcz83UjcRccqX+u+RluPn8IteZnuuoRIaOipPy3580C+IWSs/3vBpFZWOwykyAB9sWrthtowQk5mU609KRj3+qFVG2okZ/cFtVzBD8eg+Ip+JCJLOVO/5zl9tZ6j8pkdeTDipKjH2k5ylxzgNPxAJCOWhwqD3+ygyC+ht3/ejRYdvg5wfgvhqvnsbyZjixk+O2YRagb05Zb8ZMj/gwr6RZLPnyFQm9Ez/CBYPnrPmK2DFOfCt9hN0Frtu1pUzVptk+YXMfheY4cadbtASgXLBhpUr1ojfFA2hO+lrWe7Lmhg7TZjGKqCQ== 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=dN2B5kbnK2i5AlX7Uu64A7nexo4CH2qnf8WomNzIHJI=; b=uLAu3ez/MUfebRUmltCCdRe56W6OWxk/1XL7ci307li8PxWc2/kCTL7xaBOsuQPq1fJBIf2E5vEK7hPmVMmNPa7MtqD1hOZ5tnyWbk873sLPPc0nshYoDE1ds57tWVCRvOCvq3Mb9LBLfS6eujISfyaOxx2O1xLSnciXSol9uXY= Received: from PH0PR10MB5777.namprd10.prod.outlook.com (2603:10b6:510:128::16) by MN2PR10MB4144.namprd10.prod.outlook.com (2603:10b6:208:1d6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8466.14; Fri, 21 Feb 2025 16:12:17 +0000 Received: from PH0PR10MB5777.namprd10.prod.outlook.com ([fe80::75a8:21cc:f343:f68c]) by PH0PR10MB5777.namprd10.prod.outlook.com ([fe80::75a8:21cc:f343:f68c%4]) with mapi id 15.20.8466.015; Fri, 21 Feb 2025 16:12:17 +0000 Date: Fri, 21 Feb 2025 11:11:51 -0500 From: "Liam R. Howlett" To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, peterz@infradead.org, willy@infradead.org, lorenzo.stoakes@oracle.com, david.laight.linux@gmail.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mjguzik@gmail.com, oliver.sang@intel.com, mgorman@techsingularity.net, david@redhat.com, peterx@redhat.com, oleg@redhat.com, dave@stgolabs.net, paulmck@kernel.org, brauner@kernel.org, dhowells@redhat.com, hdanton@sina.com, hughd@google.com, lokeshgidra@google.com, minchan@google.com, jannh@google.com, shakeel.butt@linux.dev, souravpanda@google.com, pasha.tatashin@soleen.com, klarasmodin@gmail.com, richard.weiyang@gmail.com, corbet@lwn.net, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v10 04/18] mm: introduce vma_iter_store_attached() to use with attached vmas Message-ID: <3t6mrzpv2ylqgkwrjvu6wjazrjxqupoz3wxsmbmawmlyodrwhs@vlxleb5wjsfv> Mail-Followup-To: "Liam R. Howlett" , Suren Baghdasaryan , akpm@linux-foundation.org, peterz@infradead.org, willy@infradead.org, lorenzo.stoakes@oracle.com, david.laight.linux@gmail.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mjguzik@gmail.com, oliver.sang@intel.com, mgorman@techsingularity.net, david@redhat.com, peterx@redhat.com, oleg@redhat.com, dave@stgolabs.net, paulmck@kernel.org, brauner@kernel.org, dhowells@redhat.com, hdanton@sina.com, hughd@google.com, lokeshgidra@google.com, minchan@google.com, jannh@google.com, shakeel.butt@linux.dev, souravpanda@google.com, pasha.tatashin@soleen.com, klarasmodin@gmail.com, richard.weiyang@gmail.com, corbet@lwn.net, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com References: <20250213224655.1680278-1-surenb@google.com> <20250213224655.1680278-5-surenb@google.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250213224655.1680278-5-surenb@google.com> User-Agent: NeoMutt/20240425 X-ClientProxiedBy: YT3PR01CA0113.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:85::16) To PH0PR10MB5777.namprd10.prod.outlook.com (2603:10b6:510:128::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR10MB5777:EE_|MN2PR10MB4144:EE_ X-MS-Office365-Filtering-Correlation-Id: 33906e86-0503-4d6c-433a-08dd52928306 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?gJ977KlB9fAIP+jVbssiAMIfmBQToI7tNca6Tzd0mDZGHx0/uLXsKsfy9srR?= =?us-ascii?Q?FL1GcINmcFwsJq+sjLnOHcjw27gGGdYKqBllWMq1LvskPZN4YEMXvDgI/ljc?= =?us-ascii?Q?YSq3bzJygHWa4RIOTrtXTTyboi7gibM21lLMvdz/985o0msDiFhPKuBsoDwE?= =?us-ascii?Q?reqENvTm5cT0A+pLkL6V8O6USV/wl+yTsoas14A2n3ZgpINT+XkotNzkktid?= =?us-ascii?Q?V66JiVvTHb/bN6AH2hoBz4e0JEJI1K7lkz49KjtIqTFN75FlwHXaE9qB95o2?= =?us-ascii?Q?ubA4KNv+kvsj578aMFHEVRLuK54TKvYe6e7AmW9v3P+ryTJccomKxflDWf7Y?= =?us-ascii?Q?GZqeQuWmUS47jf5XamLeTIxFF1QOl6YRhf4yxynNk5tJU1pCdNsLkBBOfTV4?= =?us-ascii?Q?GrQ3UPDWAXVJnYH1huI3zTuYWeQ6+Kz6t68qJS63UPMiV001lABxVrq63cB0?= =?us-ascii?Q?pet0ZROb/Jzk6UI6Rz7SsDdK9hSdFmVIL0y2TKM8YYKBTZfG0ZcuACmqbW+e?= =?us-ascii?Q?5yritF4F0I/o6TcbCQCpNgfknmfOw5giIh78wU8mLuTtbi3mP6dHcynSP0iU?= =?us-ascii?Q?FPtax2spORcYskUj7g58qpFJ7LHFDubWQ0W6jxkQXg2r6W5oOMGC7tzrdDos?= =?us-ascii?Q?jwh4c3LULtbS79ooNZayUFMgFzKkkY4P2/fWnYCy9Q+MgUmn8iCN/l4vsfaL?= =?us-ascii?Q?gmp0EQ0jFszaoktkq+pWnM+7w1NG/wAH3gPjyRTGBrAu90YM5d5X/kzqZEph?= =?us-ascii?Q?VzzdWy3OHUROA+a1zmMu+8KVi+YAVfTnFTyWpTZiCpD7Ez2/Pu3ULxUh6vuq?= =?us-ascii?Q?nq5ssCmj0qSExuAYav5MzJJaop96aMs81TVfuNEIPGP0x11PTXAvkYcD4COX?= =?us-ascii?Q?JNMTHdftI0oeNSDipywJ7pZ1f48F24ahAPSu8iXH14AQfZ+eYK8QjnfghPVB?= =?us-ascii?Q?aA1wyXF21eoUBFNv9hVfJHaj+AZPeb7H7DOyM7M1XxWn05IkBV2/bmDr9F99?= =?us-ascii?Q?TK/H3r1ia1Iocqf1+fD5cXLSKVDzQrb15SGNv7QVHtJ/0jWIxYxKU3T7Wzau?= =?us-ascii?Q?10CZL+d6gbGasKOU2CO4j1D6vSsrvbP5fpYKbyLfXnJ1hZMFmtXDKsJrI7p2?= =?us-ascii?Q?leZwrLQOLlPj+loFRGu1nmFLsleBxi3WkkcR1AKp1NDooiBKcSf1m+osIp0N?= =?us-ascii?Q?TxoVPhqLPyfRB3cjvUvQAKDNg6WFnPkLqzUdWPxZvIfNqeJk0RQfLyJFAczw?= =?us-ascii?Q?zplrsGgWwCDYk+XChrBeWCJA+1oQMduuMnWDujB1A4J3AgsJOv5d+DLR+yZj?= =?us-ascii?Q?/F0ENWD9U6eo4Q3A1fk6JpbHHOYiBcJuM0IbiIHv21yudqZsv59/jE6rcakv?= =?us-ascii?Q?E0Wq67nZrUGcfDuNO1mIT/CMii2e?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR10MB5777.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(366016)(1800799024)(7053199007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?lC+qCmW/lYd3b3TrLzPKAMI2NNfastGaKW/1HdHu0gxKrezSPnCfNVYV1oL5?= =?us-ascii?Q?APycDnPDqffsAJlGw/k3tomxA9+n17Z4h4c2rr21LGTXfCkeU7NYFF1ujYIV?= =?us-ascii?Q?FsOgAW0pU2RG1l4tK+4CgNejlV21cotv+3XKWwJyuQod77Uwtd/mNfwQCvPs?= =?us-ascii?Q?XKpAHEVpn6HGuE6jhIwikR9eK1y4WYIXU8KJ4WpokWQ00CiRR03CQdAyzQ5d?= =?us-ascii?Q?5ti1Au8mW4pwJM9yllpQMHi/L/CU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bE+MQFuSAE/63Qv9+jo8pBYBDPkxiRMf3okNdVvOcT3/Gwk3lroW7HDC8fJUb6ucUakup0Ie2sC7OvdmW7bv5T09uP6XeApFwQucmZHIVZlqHvc0Z+zzCKAyU4fEZlvvkDHr6uF7ajJEJDaqzKPag8Nc3uuQORc5BHOOmmlZl6WABSOyabmv1xxYcjlZRjaV9nKYhgGdFHpAlODk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33906e86-0503-4d6c-433a-08dd52928306 X-MS-Exchange-CrossTenant-AuthSource: PH0PR10MB5777.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2025 16:12:17.5627 (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: qfdY12P7Ph2TBomZv97sMHjYRNomLWoCYDesJoqBnl7Mdvu3q2OPd2uvFnvrf2gkvfY/Cgf0l3PhJfQ9rDKIjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4144 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-02-21_05,2025-02-20_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 bulkscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2502100000 definitions=main-2502210115 X-Proofpoint-ORIG-GUID: ABDXCoBMlVmXZDIOdzh_wRFvBaB4x4Ff X-Proofpoint-GUID: ABDXCoBMlVmXZDIOdzh_wRFvBaB4x4Ff X-Rspam-User: X-Rspamd-Queue-Id: 19FA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idnqtRfqqVOEeQzydshR5Z9kH0Na11Rw9ndJhlfLrTNxdox9BcppySEC+BSMHFi4r31aGQQaqTuE53XAXeuVQlqtaQyKh9s9qwV2QYNgNIl8rRPyMH3eEDB37aWCcGOuIRIIS/sajfTK2fl+0MZNw+aS4ihnDa6zjHRJyeb2H6wBd7KGO/r0oTeA1chJKcidW2q4/C7YdaJ8ZILjVkQNMP3r1O9GQJmGp6fyEiYW8l51KPTrBf+9Jj3DkW0PoHmxQWKZ5yLSkgwpev2tk+9F6EdoBsha3p2L7kQ1loFtBxgIYzK3dlQvlBJIMWE9DTh+8GxlL8T+N7zzR2JuhgjyAcya+tWpSh/z0t1KRKc/BUWjQ12tlyPi25aonLFYg5gC9aGVbTyqNAJ7hvnctZ8ImtNF9ryshMV6gF7P5o7B0y0mbFykgbEwjY8wvbd0VZlzYU6ozu514I43DSPWSbrowBonmieDxCG7EatkgWmQjovKqTRQ0vsm86f8mg31vEUZgv6SZehCav8wGZSKj0GPBQi+cDxc+I378cVAB2jtNJoFGDZ/1flYESUPWpTBfQ3pQCwuTmTfmEl+hwIy6U9Ys33HAVNCndubj6d6Sj6fo9hjcfgszD2Du+azlyth1M3ROUB4MLYhyZqHEr3QzlBUt5aiSbb6ZisUTSVmGjopI7Ll3ZCrMPrjb0HQowirnNIl8g6j7sxzywZMs9eA6mk6kCjc+h7UWoiRqQFpko= 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: * Suren Baghdasaryan [250213 17:47]: > vma_iter_store() functions can be used both when adding a new vma and > when updating an existing one. However for existing ones we do not need > to mark them attached as they are already marked that way. With > vma->detached being a separate flag, double-marking a vmas as attached > or detached is not an issue because the flag will simply be overwritten > with the same value. However once we fold this flag into the refcount > later in this series, re-attaching or re-detaching a vma becomes an > issue since these operations will be incrementing/decrementing a > refcount. > Introduce vma_iter_store_new() and vma_iter_store_overwrite() to replace > vma_iter_store() and avoid re-attaching a vma during vma update. Add > assertions in vma_mark_attached()/vma_mark_detached() to catch invalid > usage. Update vma tests to check for vma detached state correctness. > > Signed-off-by: Suren Baghdasaryan Reviewed-by: Liam R. Howlett > --- > Changes since v9 [1]: > - Change VM_BUG_ON_VMA() to WARN_ON_ONCE() in vma_assert_{attached|detached}, > per Lorenzo Stoakes > - Rename vma_iter_store() into vma_iter_store_new(), per Lorenzo Stoakes > - Expand changelog, per Lorenzo Stoakes > - Update vma tests to check for vma detached state correctness, > per Lorenzo Stoakes > > [1] https://lore.kernel.org/all/20250111042604.3230628-5-surenb@google.com/ > > include/linux/mm.h | 14 +++++++++++ > mm/nommu.c | 4 +-- > mm/vma.c | 12 ++++----- > mm/vma.h | 11 +++++++-- > tools/testing/vma/vma.c | 42 +++++++++++++++++++++++++------- > tools/testing/vma/vma_internal.h | 10 ++++++++ > 6 files changed, 74 insertions(+), 19 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index cd5ee61e98f2..1b8e72888124 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -821,8 +821,19 @@ static inline void vma_assert_locked(struct vm_area_struct *vma) > vma_assert_write_locked(vma); > } > > +static inline void vma_assert_attached(struct vm_area_struct *vma) > +{ > + WARN_ON_ONCE(vma->detached); > +} > + > +static inline void vma_assert_detached(struct vm_area_struct *vma) > +{ > + WARN_ON_ONCE(!vma->detached); > +} > + > static inline void vma_mark_attached(struct vm_area_struct *vma) > { > + vma_assert_detached(vma); > vma->detached = false; > } > > @@ -830,6 +841,7 @@ static inline void vma_mark_detached(struct vm_area_struct *vma) > { > /* When detaching vma should be write-locked */ > vma_assert_write_locked(vma); > + vma_assert_attached(vma); > vma->detached = true; > } > > @@ -866,6 +878,8 @@ static inline void vma_end_read(struct vm_area_struct *vma) {} > static inline void vma_start_write(struct vm_area_struct *vma) {} > static inline void vma_assert_write_locked(struct vm_area_struct *vma) > { mmap_assert_write_locked(vma->vm_mm); } > +static inline void vma_assert_attached(struct vm_area_struct *vma) {} > +static inline void vma_assert_detached(struct vm_area_struct *vma) {} > static inline void vma_mark_attached(struct vm_area_struct *vma) {} > static inline void vma_mark_detached(struct vm_area_struct *vma) {} > > diff --git a/mm/nommu.c b/mm/nommu.c > index baa79abdaf03..8b31d8396297 100644 > --- a/mm/nommu.c > +++ b/mm/nommu.c > @@ -1191,7 +1191,7 @@ unsigned long do_mmap(struct file *file, > setup_vma_to_mm(vma, current->mm); > current->mm->map_count++; > /* add the VMA to the tree */ > - vma_iter_store(&vmi, vma); > + vma_iter_store_new(&vmi, vma); > > /* we flush the region from the icache only when the first executable > * mapping of it is made */ > @@ -1356,7 +1356,7 @@ static int split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, > > setup_vma_to_mm(vma, mm); > setup_vma_to_mm(new, mm); > - vma_iter_store(vmi, new); > + vma_iter_store_new(vmi, new); > mm->map_count++; > return 0; > > diff --git a/mm/vma.c b/mm/vma.c > index 498507d8a262..f72b73f57451 100644 > --- a/mm/vma.c > +++ b/mm/vma.c > @@ -320,7 +320,7 @@ static void vma_complete(struct vma_prepare *vp, struct vma_iterator *vmi, > * us to insert it before dropping the locks > * (it may either follow vma or precede it). > */ > - vma_iter_store(vmi, vp->insert); > + vma_iter_store_new(vmi, vp->insert); > mm->map_count++; > } > > @@ -700,7 +700,7 @@ static int commit_merge(struct vma_merge_struct *vmg) > vmg->__adjust_middle_start ? vmg->middle : NULL); > vma_set_range(vma, vmg->start, vmg->end, vmg->pgoff); > vmg_adjust_set_range(vmg); > - vma_iter_store(vmg->vmi, vmg->target); > + vma_iter_store_overwrite(vmg->vmi, vmg->target); > > vma_complete(&vp, vmg->vmi, vma->vm_mm); > > @@ -1707,7 +1707,7 @@ int vma_link(struct mm_struct *mm, struct vm_area_struct *vma) > return -ENOMEM; > > vma_start_write(vma); > - vma_iter_store(&vmi, vma); > + vma_iter_store_new(&vmi, vma); > vma_link_file(vma); > mm->map_count++; > validate_mm(mm); > @@ -2386,7 +2386,7 @@ static int __mmap_new_vma(struct mmap_state *map, struct vm_area_struct **vmap) > > /* Lock the VMA since it is modified after insertion into VMA tree */ > vma_start_write(vma); > - vma_iter_store(vmi, vma); > + vma_iter_store_new(vmi, vma); > map->mm->map_count++; > vma_link_file(vma); > > @@ -2862,7 +2862,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) > anon_vma_interval_tree_pre_update_vma(vma); > vma->vm_end = address; > /* Overwrite old entry in mtree. */ > - vma_iter_store(&vmi, vma); > + vma_iter_store_overwrite(&vmi, vma); > anon_vma_interval_tree_post_update_vma(vma); > > perf_event_mmap(vma); > @@ -2942,7 +2942,7 @@ int expand_downwards(struct vm_area_struct *vma, unsigned long address) > vma->vm_start = address; > vma->vm_pgoff -= grow; > /* Overwrite old entry in mtree. */ > - vma_iter_store(&vmi, vma); > + vma_iter_store_overwrite(&vmi, vma); > anon_vma_interval_tree_post_update_vma(vma); > > perf_event_mmap(vma); > diff --git a/mm/vma.h b/mm/vma.h > index bffb56afce5f..55be77ff042f 100644 > --- a/mm/vma.h > +++ b/mm/vma.h > @@ -413,9 +413,10 @@ static inline struct vm_area_struct *vma_iter_load(struct vma_iterator *vmi) > } > > /* Store a VMA with preallocated memory */ > -static inline void vma_iter_store(struct vma_iterator *vmi, > - struct vm_area_struct *vma) > +static inline void vma_iter_store_overwrite(struct vma_iterator *vmi, > + struct vm_area_struct *vma) > { > + vma_assert_attached(vma); > > #if defined(CONFIG_DEBUG_VM_MAPLE_TREE) > if (MAS_WARN_ON(&vmi->mas, vmi->mas.status != ma_start && > @@ -438,7 +439,13 @@ static inline void vma_iter_store(struct vma_iterator *vmi, > > __mas_set_range(&vmi->mas, vma->vm_start, vma->vm_end - 1); > mas_store_prealloc(&vmi->mas, vma); > +} > + > +static inline void vma_iter_store_new(struct vma_iterator *vmi, > + struct vm_area_struct *vma) > +{ > vma_mark_attached(vma); > + vma_iter_store_overwrite(vmi, vma); > } > > static inline unsigned long vma_iter_addr(struct vma_iterator *vmi) > diff --git a/tools/testing/vma/vma.c b/tools/testing/vma/vma.c > index c7ffa71841ca..11f761769b5b 100644 > --- a/tools/testing/vma/vma.c > +++ b/tools/testing/vma/vma.c > @@ -74,10 +74,22 @@ static struct vm_area_struct *alloc_vma(struct mm_struct *mm, > ret->vm_end = end; > ret->vm_pgoff = pgoff; > ret->__vm_flags = flags; > + vma_assert_detached(ret); > > return ret; > } > > +/* Helper function to allocate a VMA and link it to the tree. */ > +static int attach_vma(struct mm_struct *mm, struct vm_area_struct *vma) > +{ > + int res; > + > + res = vma_link(mm, vma); > + if (!res) > + vma_assert_attached(vma); > + return res; > +} > + > /* Helper function to allocate a VMA and link it to the tree. */ > static struct vm_area_struct *alloc_and_link_vma(struct mm_struct *mm, > unsigned long start, > @@ -90,7 +102,7 @@ static struct vm_area_struct *alloc_and_link_vma(struct mm_struct *mm, > if (vma == NULL) > return NULL; > > - if (vma_link(mm, vma)) { > + if (attach_vma(mm, vma)) { > vm_area_free(vma); > return NULL; > } > @@ -108,6 +120,7 @@ static struct vm_area_struct *alloc_and_link_vma(struct mm_struct *mm, > /* Helper function which provides a wrapper around a merge new VMA operation. */ > static struct vm_area_struct *merge_new(struct vma_merge_struct *vmg) > { > + struct vm_area_struct *vma; > /* > * For convenience, get prev and next VMAs. Which the new VMA operation > * requires. > @@ -116,7 +129,11 @@ static struct vm_area_struct *merge_new(struct vma_merge_struct *vmg) > vmg->prev = vma_prev(vmg->vmi); > vma_iter_next_range(vmg->vmi); > > - return vma_merge_new_range(vmg); > + vma = vma_merge_new_range(vmg); > + if (vma) > + vma_assert_attached(vma); > + > + return vma; > } > > /* > @@ -125,7 +142,12 @@ static struct vm_area_struct *merge_new(struct vma_merge_struct *vmg) > */ > static struct vm_area_struct *merge_existing(struct vma_merge_struct *vmg) > { > - return vma_merge_existing_range(vmg); > + struct vm_area_struct *vma; > + > + vma = vma_merge_existing_range(vmg); > + if (vma) > + vma_assert_attached(vma); > + return vma; > } > > /* > @@ -260,8 +282,8 @@ static bool test_simple_merge(void) > .pgoff = 1, > }; > > - ASSERT_FALSE(vma_link(&mm, vma_left)); > - ASSERT_FALSE(vma_link(&mm, vma_right)); > + ASSERT_FALSE(attach_vma(&mm, vma_left)); > + ASSERT_FALSE(attach_vma(&mm, vma_right)); > > vma = merge_new(&vmg); > ASSERT_NE(vma, NULL); > @@ -285,7 +307,7 @@ static bool test_simple_modify(void) > struct vm_area_struct *init_vma = alloc_vma(&mm, 0, 0x3000, 0, flags); > VMA_ITERATOR(vmi, &mm, 0x1000); > > - ASSERT_FALSE(vma_link(&mm, init_vma)); > + ASSERT_FALSE(attach_vma(&mm, init_vma)); > > /* > * The flags will not be changed, the vma_modify_flags() function > @@ -351,7 +373,7 @@ static bool test_simple_expand(void) > .pgoff = 0, > }; > > - ASSERT_FALSE(vma_link(&mm, vma)); > + ASSERT_FALSE(attach_vma(&mm, vma)); > > ASSERT_FALSE(expand_existing(&vmg)); > > @@ -372,7 +394,7 @@ static bool test_simple_shrink(void) > struct vm_area_struct *vma = alloc_vma(&mm, 0, 0x3000, 0, flags); > VMA_ITERATOR(vmi, &mm, 0); > > - ASSERT_FALSE(vma_link(&mm, vma)); > + ASSERT_FALSE(attach_vma(&mm, vma)); > > ASSERT_FALSE(vma_shrink(&vmi, vma, 0, 0x1000, 0)); > > @@ -1522,11 +1544,11 @@ static bool test_copy_vma(void) > > vma = alloc_and_link_vma(&mm, 0x3000, 0x5000, 3, flags); > vma_new = copy_vma(&vma, 0, 0x2000, 0, &need_locks); > - > ASSERT_NE(vma_new, vma); > ASSERT_EQ(vma_new->vm_start, 0); > ASSERT_EQ(vma_new->vm_end, 0x2000); > ASSERT_EQ(vma_new->vm_pgoff, 0); > + vma_assert_attached(vma_new); > > cleanup_mm(&mm, &vmi); > > @@ -1535,6 +1557,7 @@ static bool test_copy_vma(void) > vma = alloc_and_link_vma(&mm, 0, 0x2000, 0, flags); > vma_next = alloc_and_link_vma(&mm, 0x6000, 0x8000, 6, flags); > vma_new = copy_vma(&vma, 0x4000, 0x2000, 4, &need_locks); > + vma_assert_attached(vma_new); > > ASSERT_EQ(vma_new, vma_next); > > @@ -1576,6 +1599,7 @@ static bool test_expand_only_mode(void) > ASSERT_EQ(vma->vm_pgoff, 3); > ASSERT_TRUE(vma_write_started(vma)); > ASSERT_EQ(vma_iter_addr(&vmi), 0x3000); > + vma_assert_attached(vma); > > cleanup_mm(&mm, &vmi); > return true; > diff --git a/tools/testing/vma/vma_internal.h b/tools/testing/vma/vma_internal.h > index f93f7f74f97b..34277842156c 100644 > --- a/tools/testing/vma/vma_internal.h > +++ b/tools/testing/vma/vma_internal.h > @@ -470,6 +470,16 @@ static inline void vma_lock_init(struct vm_area_struct *vma) > vma->vm_lock_seq = UINT_MAX; > } > > +static inline void vma_assert_attached(struct vm_area_struct *vma) > +{ > + WARN_ON_ONCE(vma->detached); > +} > + > +static inline void vma_assert_detached(struct vm_area_struct *vma) > +{ > + WARN_ON_ONCE(!vma->detached); > +} > + > static inline void vma_assert_write_locked(struct vm_area_struct *); > static inline void vma_mark_attached(struct vm_area_struct *vma) > { > -- > 2.48.1.601.g30ceb7b040-goog >