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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B24ACCF9F8 for ; Thu, 30 Oct 2025 19:17:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DC6D8E0084; Thu, 30 Oct 2025 15:17:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9B4188E01DA; Thu, 30 Oct 2025 15:17:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 880CB8E0084; Thu, 30 Oct 2025 15:17:26 -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 6B1C68E0084 for ; Thu, 30 Oct 2025 15:17:26 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 09B8957339 for ; Thu, 30 Oct 2025 19:17:26 +0000 (UTC) X-FDA: 84055739292.04.C893E7D Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf30.hostedemail.com (Postfix) with ESMTP id 933F280011 for ; Thu, 30 Oct 2025 19:17:22 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2025-04-25 header.b=ZQSVpKIn; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Vh4hursM; spf=pass (imf30.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=1761851842; 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=LHU20p0tGIlmhPXcSI1HYTTNj6QJsmjEp6Cg2DhyG+4=; b=sZpm2neFtKgmuqR8cX32/v8yRncWr5zEkJh16RHRQ2Xs19KCJZNVEuwUhc27QyrN7SDPbi kpD7J5ubLjs5xIsr0mvTF7AJRI5G9zs/Y9hxOt7EbgGf0kVNBNrjxE08lEVy3lP0+/zM4P /lcJBQUK7tH9ey4GmbCxI4rdpMaqe7Q= ARC-Authentication-Results: i=2; imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2025-04-25 header.b=ZQSVpKIn; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Vh4hursM; spf=pass (imf30.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=1761851842; a=rsa-sha256; cv=pass; b=eXbCfbWkVyP+Kl1yiQzOBY5kFIq8/mmC0wJsbVHEYgDr2spfjj7vw7G7/RfgnNPWDNpJYH vb2hvDaMWdEWFh9RaaWr2L7G+KjHbLV+164h+5Zk+aWcSnpSglRtM7XjqTFjspDUtu/QGb 8Pwnqf1zk1Boasckxkzy6S/7qH61sg4= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59UIK1j2025280; Thu, 30 Oct 2025 19:17:09 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-2025-04-25; bh=LHU20p0tGIlmhPXcSI 1HYTTNj6QJsmjEp6Cg2DhyG+4=; b=ZQSVpKInochPVp+gZFiJu2pR2+Z3rcguqO cwXLiSViucuye0S1F8tIgjaEAL7/C8fM4JzXgenseAG26c57P//dMTz73NDa4FD7 ujmvRmowLbIj14HsqbHWkpNg037JgxDGlL5l4eiDaQcx5jhvLm0ZY6ZnTD8Q2e/J +/p9PBL+MSh3OIjPA5Azr6tvxgRfR4Ko1nHT8+ObmFvK6hTM9X4DcEzAguSUSiVg B6P+QoDy+d7sJEss1K6NY4h/dZWHmlUZy+5Zf4lNiGhwjk2w8b9Iu7aRD41kMnty HcPC50pCeieeqB/5g2gvSY5WfdkYghSF5QrFY2hHFKLwL5/gUR2A== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4a4d6q04f6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Oct 2025 19:17:09 +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 59UIGTD1023479; Thu, 30 Oct 2025 19:17:08 GMT Received: from byapr05cu005.outbound.protection.outlook.com (mail-westusazon11010062.outbound.protection.outlook.com [52.101.85.62]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4a33w02xgt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Oct 2025 19:17:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XmOghS9re65ZURrfJxYM7xhhJCbG/ojFEJAI5S/CLSWcVf8mT3f/Iqw90F5KOwQVU8mBkIs/9JWhyQcisFbcLdfpPOc31o/LoAEKzF8p7XbzbmbrDkaagIrraW0Bfc/y23wBA7ApLAt6zvhFZ4tyAFUjmf75EiqUfBn6TAlq46fYqAqxpSh6XE+hNQSipImqpc9XNbWceo/HgAaT3Pv0f/eCMvi0L/c7wiWCRQmW4F46u+Wq4KE8Ih7NRnot/twGt9Neyyuge9Bn4nqLjwpjMJXdifYe8HOA81hFel2beciRwn7XLcfgjxcKRjuuE2c7wYG9rviZVW4lsxSpKxeR+A== 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=LHU20p0tGIlmhPXcSI1HYTTNj6QJsmjEp6Cg2DhyG+4=; b=Oh7nrX0VyUa/aXvN2Zy84415+iiNqaY2tXAZzgbgF4vNEdvCdGViP/Pcjeav9nivnZhDLLLNG67MpNv/CDiRjcJCa8TETgeRcl8Rpa8/qDbNqokJ0MHIifyEPSSxjk9sqd/Yk1yiAHSNxqC/SQ3+cDiOCvKga3hcYXyT/rLfXRUzzFy3JWCZYxPjzhI3WPzgsfrLE7eVhqFdZnQEIRT+YLiZtK+WZKwR418KP+PLwhJWbUlj4f6j1JFVzaNzxreFY1K4p5UKJ2WrR9Hi34oFU9TZE1BIhqwUNxFm0q/xcm9ecorvuSAkMe657wI6cQElTayzig83FyGWRtlTMFvR+A== 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=LHU20p0tGIlmhPXcSI1HYTTNj6QJsmjEp6Cg2DhyG+4=; b=Vh4hursMDmN7vTk3KyUmpjS6yR/mMkxxhr/MDtc3LRrjiG09CBisiKPyERu1gdRs+yGcCXFAH9p2aLfSDM3ruXZA1e96iaBbAdWUjHewvV4ajiBSBUjdL6dmeRYjhx5BRoBb4+T79lgD+KfH0ulH+vDNRZMvDdrknL/GiLpPMR4= Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16) by DS0PR10MB6030.namprd10.prod.outlook.com (2603:10b6:8:ce::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9275.12; Thu, 30 Oct 2025 19:16:59 +0000 Received: from DM4PR10MB8218.namprd10.prod.outlook.com ([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com ([fe80::2650:55cf:2816:5f2%2]) with mapi id 15.20.9253.018; Thu, 30 Oct 2025 19:16:59 +0000 Date: Thu, 30 Oct 2025 19:16:56 +0000 From: Lorenzo Stoakes To: Vlastimil Babka Cc: Pedro Falcato , Andrew Morton , Jonathan Corbet , David Hildenbrand , "Liam R . Howlett" , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Jann Horn , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Andrei Vagin , Barry Song <21cnbao@gmail.com> Subject: Re: [PATCH 1/3] mm: introduce VM_MAYBE_GUARD and make visible for guard regions Message-ID: <6334993b-ead7-472f-bb82-bb7d6f15f3ef@lucifer.local> References: <7de40603015dee82970f5d37332a6d5af7532063.1761756437.git.lorenzo.stoakes@oracle.com> <61ae955e-310d-488e-b350-59bb809f06e1@lucifer.local> <053f3a04-9195-4f8d-8959-42e0c3ba077b@lucifer.local> <72ee2324-d599-44b6-92ce-ed0afafed78f@suse.cz> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <72ee2324-d599-44b6-92ce-ed0afafed78f@suse.cz> X-ClientProxiedBy: LO6P123CA0031.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:2fe::11) To DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR10MB8218:EE_|DS0PR10MB6030:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d01796b-bbc1-4e42-0e7f-08de17e8e5d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?kv8HqkXJ9/WUIZj9kfi+ELHqmtZTBMkUR1eeWk+CnX/4fyUnMXG/5E/BhcYq?= =?us-ascii?Q?JPlFAg+EJxr73OJRIVsPDXdtt9TonG2Z1F16rlUZnb73x97LnDVor5d3JAV5?= =?us-ascii?Q?5MR5E3CI1vmH6Pi6mBWlnQgzwduLSKTuNez2v1BQx6JA96eFbH1RfIuP7SiW?= =?us-ascii?Q?GTClR2VNUgahMCbd8erd995EvJR2BSru8Yb0Lf5fohBuyx/SDD39lTe9JuYj?= =?us-ascii?Q?eoTLiuYe8krgPq/pYnmuqYVABHIjLphR/sI59T6FjLgao6Hm9NGTbr8qlBc+?= =?us-ascii?Q?Cf6sM30uA5+z0u65fRjsY9Al2WwicZ0j2KyQFnuSv45q+/lZcj/1Jo0Lg32Y?= =?us-ascii?Q?ynQLKhYeQOu+FeyPjwfVqmW5FKGUeZ24n3AWetGQxN05w0niYXeV76Gk3YHH?= =?us-ascii?Q?Amas2LH3iWOSWSwpwDc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y?= =?us-ascii?Q?GWWQpj6Ia1eA8AT9Z9jI4R85ljXJSpRz6bMIsYmXwVEr35vVbWluvDxuC8iv?= =?us-ascii?Q?PSrKXVL3KxQgeILZntqOPxhHfY2/Oh0D+qNmAOVwI8oaeZeKFzBgbKbM0QKR?= =?us-ascii?Q?3ECEUVC+w5Ax2hnw8ChqzVE9niOh43Or?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?njMzN0uDGjSqGFsPKhpHWYHecc+S60W+gaB68kUHGnqorT5c56PYn+ERhnEc?= =?us-ascii?Q?iH2ruxuc8MN8Wl543zxKBZC3muf62xC9VZQQeVVzG+tT4fu1IEKab0pIKNUn?= =?us-ascii?Q?uesosCxlmKQ7/08jHOxE5CyuB1BMEy/RhH9Iwn4D6cH4Q2Yy9FA7CabBEvF2?= =?us-ascii?Q?yetjeZn/n7lMoZwlunQ1T6JSTV9DL+Bm8RTmA+0wQaI3NewwwthNtvHB2uHr?= =?us-ascii?Q?QfnfIK8X3XB8TsCqKnv8INct/fdd4YmbYUHm0QECLiuwL6RrVbZn4NCmY095?= =?us-ascii?Q?1chsbzXbf/aH1kKD6I9YD/fCemTkDbO7EhfxLon9x7fQJK29sJkp7B1MBuuO?= =?us-ascii?Q?Gj5Sz7myWF+u0rGpQR9o/7L5X24Tiw4svC//zyEu7AT+rpRQ+fEvO5e3ZodH?= =?us-ascii?Q?GfrsNv5rrn8e+irg8lkjX7jQZbtYHv9V9arFkGquLv76mHOW4KqwR3Af4Fmi?= =?us-ascii?Q?ESzBF6xVY9QQ1wfmHR0SRwH+DDndTC3h7R6MxP2LC0JoSG14KL7O2RkKM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OD5rh4gJ5OExtPi5n8zBqBx5pQnW93IOMYMJtcEYk7qLwQq4?= =?us-ascii?Q?jpFrI9PuzpPmHO7riCVtsbV4o9/9sFCFrk3c8aSFmc+TbtWVfBLcdFNa6tOY?= =?us-ascii?Q?hh2tvGZzM7haevx1CYbPDiCsOEQDyNldoppj8/fGjnEUUuz30T6x1WMGoW6v?= =?us-ascii?Q?kyqsRMnYkVMgFxAurW50X8HkpJr3S8tTeteY2ztcmETn5d5wqYe72tj+mgol?= =?us-ascii?Q?GQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: BSII1m3R8ZwI2aeptqmuVm3rog9rFl6uI6c4Ia+pJd/yi/3Yb41V+WblhI0Wb8ZkqLqfnrR9ffYONIBsRL2gVjx6vq03VrpJj175iWysHr82rrs07KtJ8lz6ke8S/dtowuUKtxr7Nj6peyS2AhRBG0GCc51OLA44E2VcNv9fs0ClZO4PYBNe9sXe9i/+R4RhGvREUc6frdEdVNYNXcHr7Iqz9cue5pqaQEKRI9Fz8OzGqRvamFizP9yzq+8aEvW1jHlCnODEpimE2j/t8D0ckokjyUp40P6ByW7Yzqkx9hoNnW9W5A3lEmiVOL5QiE8JlsSDgfVUYnJd88zI3HzjLaqbSd6FxJdwk5OPT50Nxfc3KYCazvh0rQtgHDFrXVmUtOjYYev75Rs6g/bW4Z8oTFzi18gwFLDH+AxfRGD7mwWEo5CR191WwbhOd6otQ4GejXeIdVOU+3XBhp0IqdHZTqF4759IBPaW0Qmz2GvYJBJReT8uA83VW53n1kD+U9wfK7grKBSVh8QHxh0jyzdWqCFwBBAzsZRU2b4ePU13ee9L5AU8LuE8rd6LGjcnydOiHO0/Sn5Bz4uJnCcULGI7pYBq2lABoTWwaqS8Yl88zVE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d01796b-bbc1-4e42-0e7f-08de17e8e5d8 X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2025 19:16:59.0928 (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: bfD8dckB5loCYyrKSpldkA8x+8xMHR5+WSFOmBm16d0B/6dqOSWVaw5xmf3A5Ml1iezSEYcijS/5vLizWCYdSB7MrOH5falqx4I5mr5HPJg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6030 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-10-30_06,2025-10-29_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 malwarescore=0 bulkscore=0 mlxscore=0 adultscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2510240000 definitions=main-2510300161 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDMwMDE1MiBTYWx0ZWRfX+WUxPd/bo4a8 buvugtdD3YKWBlkJ9VFpozMXKXgqhywEWeeiSBtFBHlACK51j5nriUqJ3Yljm1VM6YIzBab44lD EQvi56R6037itkhSexmQc+wi0bwluGjbYsaby66OvL2k1lzYkA1WETqK3O9HI3hrjqvYjSWBiQd H4Liv5i0ROdBXDLKRV6ZdQDQPM6UNonIAQOzFTrUSuVbaUmf7B0DHHFPbbA2p6NGmCSQSkrYw0v dY82V+OesXnSAV3e526LR8TRHgk88q30iBmaCetPIBeeHVWVi5aeVd/IUh2g7aCb/e9UxYsiwcQ eulKE/86S5cB0Rb/scC/WS6aT+3lXY5qAS1gVIFuf+3YPOmQSkT2ofnFVpThPw/Y2HD2+oB0c1M FksE6yZVnVKVy6ta3tc0erkLqfSn0A== X-Proofpoint-GUID: 4nwq5WcHNZEHnw7O8kb-gJRzgiTzjsEH X-Authority-Analysis: v=2.4 cv=bLob4f+Z c=1 sm=1 tr=0 ts=6903b9b5 b=1 cx=c_pps a=WeWmnZmh0fydH62SvGsd2A==:117 a=WeWmnZmh0fydH62SvGsd2A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=x6icFKpwvdMA:10 a=GoEa3M9JfhUA:10 a=VkNPw1HP01LnGYTKEx00:22 a=bxkbsJtV4hA7KuL9enYA:9 a=CjuIK1q_8ugA:10 X-Proofpoint-ORIG-GUID: 4nwq5WcHNZEHnw7O8kb-gJRzgiTzjsEH X-Rspamd-Queue-Id: 933F280011 X-Rspamd-Server: rspam11 X-Rspam-User: X-Stat-Signature: 8yt8fg5pomwykbwz5xs7jpdgxijh49gq X-HE-Tag: 1761851842-163088 X-HE-Meta: U2FsdGVkX1/kAA5Z7ZszZlEusEKVuFd7yyjI4KNpkTR5xcYQ94FdmCPHskrF9jSYs4SOKa9MFEphftMXRNjWqkZt/G1tZNlz1JPPyeK3W6+rhslkFLIUwfFrRLd00MutimtJUhy/tUODnYhlxC0F/AF07PcXLLkexUqVszOUq/btxY1t3bo5V/vm4fTrorJEyd4eUJJ+hPMhIpWDPrk3xpTq8QS+KpFmOm9gIzz4XDrZR+F8b0AP6A+quVBIXGr1hwEIdW8QeD0UI5gfvvZjLiiqcjwgMSonRSVl7yZqgh2oVEs3HeCDtnczzdTuTnxD6/G8ZXYSYh4Vl+lsZBradNSscjEfBHo61F2PBswLw01AFagYj4lHp2yyGrGoUGESnqDmkRGGlosDdnv3vpmtlrFO0vCi4qU35ZvjiccLqObEwEPlpgF4z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H2B4rW+eGJnbB6w+9PdIk+Veya3Fb6GjKCddltIsB/xjip69Gw1KDjlL0glIU7QGHxP6huDIqYUmn0GwqQLhlmHSdiArkg0UaNKagAVOcI+Q0vLz8BnbQein+At399orgbW11tjC3pytuku4EzdTAbuOk+TtVwvFCz5O8bW0= 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: On Thu, Oct 30, 2025 at 07:31:26PM +0100, Vlastimil Babka wrote: > On 10/30/25 17:43, Lorenzo Stoakes wrote: > > On Thu, Oct 30, 2025 at 04:31:56PM +0000, Pedro Falcato wrote: > >> On Thu, Oct 30, 2025 at 04:23:58PM +0000, Lorenzo Stoakes wrote: > >> > On Thu, Oct 30, 2025 at 04:16:20PM +0000, Pedro Falcato wrote: > >> > > On Wed, Oct 29, 2025 at 04:50:31PM +0000, Lorenzo Stoakes wrote: > >> > > > Currently, if a user needs to determine if guard regions are present in a > >> > > > range, they have to scan all VMAs (or have knowledge of which ones might > >> > > > have guard regions). > >> > > > > >> > > > Since commit 8e2f2aeb8b48 ("fs/proc/task_mmu: add guard region bit to > >> > > > pagemap") and the related commit a516403787e0 ("fs/proc: extend the > >> > > > PAGEMAP_SCAN ioctl to report guard regions"), users can use either > >> > > > /proc/$pid/pagemap or the PAGEMAP_SCAN functionality to perform this > >> > > > operation at a virtual address level. > >> > > > > >> > > > This is not ideal, and it gives no visibility at a /proc/$pid/smaps level > >> > > > that guard regions exist in ranges. > >> > > > > >> > > > This patch remedies the situation by establishing a new VMA flag, > >> > > > VM_MAYBE_GUARD, to indicate that a VMA may contain guard regions (it is > >> > > > uncertain because we cannot reasonably determine whether a > >> > > > MADV_GUARD_REMOVE call has removed all of the guard regions in a VMA, and > >> > > > additionally VMAs may change across merge/split). > >> > > > > >> > > > We utilise 0x800 for this flag which makes it available to 32-bit > >> > > > architectures also, a flag that was previously used by VM_DENYWRITE, which > >> > > > was removed in commit 8d0920bde5eb ("mm: remove VM_DENYWRITE") and hasn't > >> > > > bee reused yet. > >> > > > > >> > > > The MADV_GUARD_INSTALL madvise() operation now must take an mmap write > >> > > > lock (and also VMA write lock) whereas previously it did not, but this > >> > > > seems a reasonable overhead. > >> > > > >> > > Do you though? Could it be possible to simply atomically set the flag with > >> > > the read lock held? This would make it so we can't split the VMA (and tightly > >> > > >> > VMA flags are not accessed atomically so no I don't think we can do that in any > >> > workable way. > >> > > >> > >> FWIW I think you could work it as an atomic flag and treat those races as benign > >> (this one, at least). > > > > It's not benign as we need to ensure that page tables are correctly propagated > > on fork. > > Could we use MADVISE_VMA_READ_LOCK mode (would be actually an improvement > over the current MADVISE_MMAP_READ_LOCK), together with the atomic flag > setting? I think the places that could race with us to cause RMW use vma I mean, I just spoke about why I didn't think introducing an entirely new (afaik) one-sided atomic VMA flag write, so maybe deal with that first before proposing something new... We probably can use VMA read lock (actually introduced _after_ I introduced guard regions I believe) if we do not need the write lock. But I need to hear a compelling non-hand waving reason for introducing an entirely new mechanism like that which is going to violate an assumption we have about VMA flags everywhere... > write lock so that would be excluded. Fork AFAICS unfortunately doesn't (for > the oldmm) and it probably would't make sense to start doing it. Maybe we I mean, the entire point is fork behaviour, so that makes this a non-starter... > could think of something to deal with this special case... If we implemented that I guess we'd have to atomically read the VMA flag, but a race between the two would be very problematic. Note that we'd also have to have a new mechanism for writing a VMA flag (this is entirely novel now) because vm_flags_set() itself _literally_ has vma_start_write() in it. We'd also have to audit any and all cases where VMA flags are accessed to ensure that this new novel method does not cause any issues. We're also inviting others to do this kind of thing (e.g. drivers). Seems dangerous in itself. In any case, since you're now asking for something entirely novel, you really have to provide a compelling argument as to why we can't write lock. We can't allow races there or we break forking. > > >> > >> > I also don't think it's at all necessary, see below. > >> > > >> > > define what "may have a guard page"), but it sounds much better than introducing > >> > > lock contention. I don't think it is reasonable to add a write lock to a feature > >> > > that may be used by such things as thread stack allocation, malloc, etc. > >> > > >> > What lock contention? It's per-VMA so the contention is limited to the VMA in > >> > question, and only over the span of time you are setting the gaurd region. > >> > >> Don't we always need to take the mmap write lock when grabbing a VMA write > >> lock as well? > > > > Yup. But at the same time you're doing the kind of operations that'd use this > > you'd already be taking the lock anyway. > > > > You don't hold it for long and you won't be doing this any more often than you'd > > be doing other write operations, which you're also not going to be holding up > > faults on other VMAs either (they can access other VMAs despite mmap write lock > > being held), so I don't think there's ay issue here. > > > >> > >> > When allocating thread stacks you'll be mapping things into memory which... take > >> > the write lock. malloc() if it goes to the kernel will also take the write lock. > >> > > >> > >> But yes, good point, you're already serializing anyway. I don't think this is > >> a big deal. > > > > Indeed > > Besides thread stacks, I'm thinking of the userspace allocators usecase Thread stacks require mmap/VMA write lock to establish no? > (jemalloc etc) where guard regions were supposed to allow a cheap > use-after-free protection by replacing their existing > MADV_DONTNEED/MADV_FREE use with MADV_GUARD_INSTALL. First I'm hearing of this as far as I can recall... maybe worth mentioning at the time? > Now MADV_DONTNEED/MADV_FREE use MADVISE_VMA_READ_LOCK, and guard regions > moves from (worse but still reasonable) MADVISE_MMAP_READ_LOCK to the heavy I think you're hand waving a lot here, do you have data to back anything up here? Be good to get some timings with the different locks and some indication that the contention is meaningful or that this installation is in a hot-path. Are these users not in any way manipulating VMAs (seems odd for a malloc but anyway)? Because then you're already having to take the write lock to do so. process_madvise() can be used to hold the lock over the whole operation more efficiently for multiple guard region installations. > MADVISE_MMAP_WRITE_LOCK. I'm afraid this might be too heavy price for that > usecase :( Based on what? Provide some data or argument to back this up please. Since you're essentially asking me to either throw away my series or implement a risky novel means of manipulating VMA flags I think you're going to have to do better than hand waving. Thanks.