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 DCD9DCCFA05 for ; Thu, 6 Nov 2025 10:46:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 107928E000E; Thu, 6 Nov 2025 05:46:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0944B8E0002; Thu, 6 Nov 2025 05:46:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D63D08E000E; Thu, 6 Nov 2025 05:46:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B399B8E0002 for ; Thu, 6 Nov 2025 05:46:44 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7C05B13B52D for ; Thu, 6 Nov 2025 10:46:44 +0000 (UTC) X-FDA: 84079853928.16.9A61295 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf22.hostedemail.com (Postfix) with ESMTP id 262EFC000C for ; Thu, 6 Nov 2025 10:46:40 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2025-04-25 header.b=EVqqSrmP; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BBWPSc9b; spf=pass (imf22.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=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=1762426001; 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=l83b7Px4HVVWu/DG54n1uKxc/COK/eWvlZlxxmwskt0=; b=N3doRRQ2CspvT9/5J7o1hFHip+PoptLwS8GXdST4wLRbwi6VrQMWDrpeb6Xsp5LK3VVP5F CyYqos7ilSm4pVoCO2MYT38xAmWP5HOl7+60BvMxgB0+uihlisoXh1LT8c+d7eykWgSxDO Hj/mwKErjZj73T648sQ4QmO0T8p71oM= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1762426001; a=rsa-sha256; cv=pass; b=woKudinu2d3ELG+8spZkCk6OBANN9bfaHkxpgTAD7iBHsoAJ2gccVO1INKflsOt/lLf+mK 3k279AxE5NIFNL3PIM1bG/S3a7PQPq+AFTriUkcabxO1rY8BRgm8MYTV4PzSvemKITsA84 xdsgi/q+3A6E+vyVQ35AtDpUG2Comeo= ARC-Authentication-Results: i=2; imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2025-04-25 header.b=EVqqSrmP; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BBWPSc9b; spf=pass (imf22.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=pass ("microsoft.com:s=arcselector10001:i=1") 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 5A61CI9N001576; Thu, 6 Nov 2025 10:46:33 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-2025-04-25; bh=l83b7Px4HVVWu/DG54n1uKxc/COK/eWvlZlxxmwskt0=; b= EVqqSrmPTu7yWLmxmEO+PvsM+8lC4DxmcPaA7aK0kBs2tuB1ta9LC2jpPO4V7rN8 eWEhwLypjTM6mv1AiNaj1ls5az6H0mGTinQCf+Q7MN0LNkWXK1kFJIGWh2M4651I P3fILKzDHDDeHnxPoF9whpXTfItz1QiW3bedzVdFgWj01ntDpOT9XUR5vrhWOiFS 1VkBS+s144CN8ESpuATWmEcYQhnU2ecUf1QMa7NrxuE/krclQXJg1cLwlaAWD6/z PxtPShqOfPdjQ7Ml+hWoaY635G4mVnpm2LlUO4PpEM44sdTdNKVMF9jpDo5pyj63 zGkC9JOW7ZEoLhUO2E7pHg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4a8aqw9qva-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Nov 2025 10:46:33 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 5A69pktd010962; Thu, 6 Nov 2025 10:46:32 GMT Received: from cy7pr03cu001.outbound.protection.outlook.com (mail-westcentralusazon11010000.outbound.protection.outlook.com [40.93.198.0]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4a58nc8c4y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Nov 2025 10:46:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Dl6GW+wzf6RHAtchkkb3saO/sxXhhoJ2k9HlH/ufb+N7rwUwuT9u5eFGsXsiBT69TBJRx5kTX249TQowRg+lmvB4cqbWVpBKMT1tMloN0zpkm/SJBOAiXRGyphqOpyT6ZxwTA2TD6MEo3+zclduZ0Ro7ZL/p0fdNdw6vHkf2Y7sqzveOlAOjzca5yNcaKzKNbPeXcB9rrEHZt8dyhimgWcTueROletD02nW6C72G6b+Rn90fJ3sqjE5WgbKzJrGZZVb8ZvgVvKh3Zu9HrF2bv7k2PZv3e6pCwvq6awYlbzQwm5JRK2/J7OLuI2Rv/xyyRkjF9xKUT44sIF6tdOMECQ== 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=l83b7Px4HVVWu/DG54n1uKxc/COK/eWvlZlxxmwskt0=; b=ufoGf0P6ww+5RJPNd/N3iEfMOT8IvsdkN8RUoVOUADdcpGtG18G+Y4CckPYkPaTeIwSrCzR9Z5b5431K/BsYIoB3fmNjWPn5dBhWlGIoiffQduIDXMls+WCgyDyq6kymeOzzOXvgedGAgtib0fUZQypTZ9aEHxBe2axj8NEW+gqVhuuL1kznqTCb5lWo1buErIgi0eNtqwHB4XDZd2MseTHgq6CIj5HwVZitx2fNT7ld+DWN/IhBS7Onp6mOUrfoxqM8ktErdy5kTwsyTyVDEuwSjMnUlrszja8kOVR3E7DpkcxVKcG6TAilHCCiuTC2gEQ5aRHqF3K2lmRD5BOl2Q== 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=l83b7Px4HVVWu/DG54n1uKxc/COK/eWvlZlxxmwskt0=; b=BBWPSc9bmh8J/JChr8T9MZb1+b0zwo06bYsgY4/aGLr2wURHKuolUyOqFj7v1BQ1ue6gyjq0euwYJs/fQA5wK/TuEUf6YvzTil+IsByKACcdlw9G2dzL8BZ9eWFpZmR/wi+KU/GBRswhlQvebPoYt5afgPuOesW5xXyCtcs4AaM= Received: from DM4PR10MB8218.namprd10.prod.outlook.com (2603:10b6:8:1cc::16) by IA3PR10MB8250.namprd10.prod.outlook.com (2603:10b6:208:573::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9298.7; Thu, 6 Nov 2025 10:46:29 +0000 Received: from DM4PR10MB8218.namprd10.prod.outlook.com ([fe80::2650:55cf:2816:5f2]) by DM4PR10MB8218.namprd10.prod.outlook.com ([fe80::2650:55cf:2816:5f2%6]) with mapi id 15.20.9275.015; Thu, 6 Nov 2025 10:46:29 +0000 From: Lorenzo Stoakes To: Andrew Morton Cc: Jonathan Corbet , David Hildenbrand , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Jann Horn , Pedro Falcato , 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 Subject: [PATCH v2 3/5] mm: implement sticky, copy on fork VMA flags Date: Thu, 6 Nov 2025 10:46:14 +0000 Message-ID: <9c9e9fb6b767556594b2cef023db01d45d8f8463.1762422915.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: LO4P265CA0275.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:37a::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_|IA3PR10MB8250:EE_ X-MS-Office365-Filtering-Correlation-Id: 19bed493-c231-470f-c9af-08de1d21bddb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|366016; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?xYCCo93Zk9p3nynY2dEgud53Kqe/2IkxXXF8WOEChXGjT5MMZDbs9B8RhnY/?= =?us-ascii?Q?MHehZKigMrTk8APm1DSdSGB4xUbAvKd/SKm1ddHYxCFVEZVBI1vEq07Nk88z?= =?us-ascii?Q?M6YU/VWqOSUztRiWCq0006nuUX2kDAhwUjwuFcP8UfQP24q7zLucnHCRcStq?= =?us-ascii?Q?x00xmqr/7ME7s8VsFYVzEnVjA5slW3SbRkbz53T+82AsNc+e+ONeHn732+So?= =?us-ascii?Q?ZK++fSgSq+hEm5BIkdt7gNkMgKRkKKP/SoNUU14vxPwtBSRLb/baOSSMIVk6?= =?us-ascii?Q?6xBfsmWfsejwap3nPl4HLm7KVmlcOC9aHoobJCL76BocI+MZEFJdvcEyYe/U?= =?us-ascii?Q?tK1NyAectIf52vV+bFluBeICfOiUykPajVd8f+h9AfhKQaxSLxC5ocYb8zLK?= =?us-ascii?Q?xV03Ihvt7mnAiLhE/y2toYvGeazhgi1XZDnZQRS0T6y/V7NAvaobFNF81+xc?= =?us-ascii?Q?2qdm4d/IfDBRQgiOIB01u4+6uwawSWReRT4+WQID4Yi0D60y6x/Gf2BaqHW9?= =?us-ascii?Q?hL5NX/L5q20G+ouUQn46zyZYafQQxPX8IAmSfOJ6CVO2hERdM832zt3zul4c?= =?us-ascii?Q?47wEIr1/qWjrloF9IWmwsli2s3vOpQH+x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:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR10MB8218.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?UO/Zk49BsSRe3mf5ys7lRNkxd23smv58WdaVJy4amPwfUkE838oi8qtng9vO?= =?us-ascii?Q?VQZ/MyN1gub80AY0lfwDK3jZlYuYQaUUQ40MNDmXqIPlwRCRZwImnVqUlOum?= =?us-ascii?Q?qcQnCQZjiOCcMfqYGNZk7LOTwlzyIWW4F+JVeS88A4awxI5NEa4JmvWdss1H?= =?us-ascii?Q?iwjQv6gMYir/5lStz6XWU2VHRMnZLR7W1DlEVpCsdVOg6oZyFBQQD5c3luPW?= =?us-ascii?Q?3SRDIvxhoDyKZYJPvq6FcFFmi59MzTfnGg9OwVPGPr93fppxfvlNIsbWyUCB?= =?us-ascii?Q?mzVzydeNRJtyxZRoNjgR9INazAgcKhzNDF2ImLwKgkH1xrKwlaGejFw7bdxj?= =?us-ascii?Q?g1w4x2f2SppsKxlWJjQNiVk17etDXs0Ks3o4HAKPz2QnHpyRrX74d0UtvOS9?= =?us-ascii?Q?s5l79YYUCYY1pkQmIgvqEa1Ubk1dcbrHq4m8pOP56m5VJCtVuf7fM7Beu5zj?= =?us-ascii?Q?B2tUkhgpVys16wlYCN9LJCV4Kad/lJbEOaldY1mYpYQVJTFTYKQWc0lbj+KB?= =?us-ascii?Q?GRQPGj7FrzOEkkQsOJPcNEPshW/fxNSk0NQLaV+BElJK1VleJGsReBza+vBX?= =?us-ascii?Q?85j2dfklTT5MMsSWNDKAnww7PfOWkI2Xd2Reu5C/4EtA1KcMaXtvGEDulGkQ?= =?us-ascii?Q?6dy4KNoaWHMSvIYJwqEx8fc0deNN5N9aFSl9Ghy/z/QyH/XOpfVvEkW7oSeR?= =?us-ascii?Q?tjbc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69JszIf?= =?us-ascii?Q?RQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ++aOh5L6Y3XNfLPB+X2VRWkiMk+OO+3FArVR7tvjGpLbxkjMJGxDzLRzR1M+1VEBsRGlhuWrRX1OIbLvjjlYNb6pFvN99ea7QjZ2rfTfKABhk5zdsiKiqE4vZW7/PEvqXbXP5O0n9lBGROLesxP1B/6e3ba05y7/sB37WO8g9P3EYZSt+lyVmAoItA6ARBymMwp0HNY957+7s39C0+EoVVxvO1isefWraxEX87UhgLxOg2D4YhvuuAIP60q4O+9m5ETbmaamNRudvXJCul8zgQR7q4DUSL2DI6elCU1KW0Anmv651uOdQQu4rULnGNhwo3AS6UI247xOE3CKaILFz/9LD/GZaPJ80kOlgifLsazEOQ06D4R2Fn+4WAap5ZoGbcMDfN4JESG65/+UOHI320dul822tPdMB1Ir6FmWOCFhvvGsSQtx8C3d33svxmjMt5jvyCS/yHzD180UzvZ8/1eFQqnwhRt4wX27RjWde0/PetVC9P+qgZcEHqJWhe3sax1ZqTPHkAE4UNyY3KVdaLLX0bhW2KK6JqcrofIlFGoP+vgBoA8LKvL/EhphWsNQLgiWu2C6jdwV+mqYHaf4NxQhR3O0P69pxSUzAnOUom4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19bed493-c231-470f-c9af-08de1d21bddb X-MS-Exchange-CrossTenant-AuthSource: DM4PR10MB8218.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2025 10:46:29.1143 (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: 5CZr6yoI/ssM6acxqmqce7m5TmSl2k3TvglKXr4u5I5CA0OpaTLSYKTQxF1dJDirt7urtAlUvhRW4Fdf7iw/vE52twQRKaZQuAo3vO2fx/A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA3PR10MB8250 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-11-06_02,2025-11-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2510240000 definitions=main-2511060084 X-Authority-Analysis: v=2.4 cv=NajrFmD4 c=1 sm=1 tr=0 ts=690c7c89 cx=c_pps a=OOZaFjgC48PWsiFpTAqLcw==:117 a=OOZaFjgC48PWsiFpTAqLcw==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=6UeiqGixMTsA:10 a=GoEa3M9JfhUA:10 a=VkNPw1HP01LnGYTKEx00:22 a=yPCof4ZbAAAA:8 a=mMqtBKPntBUHp3g5CqAA:9 a=cPQSjfK2_nFv0Q5t_7PE:22 X-Proofpoint-ORIG-GUID: nQHFjSBWeeQlJQBfv4pqZ1Y3v9dZ0TGr X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTA1MDEzMyBTYWx0ZWRfX+QZ8nhAwQcXg 8dDA21ALoNSsWGx/KWG5iUIrAnGG8fO/3pH4PU1juAAVkiMb7evH8zE5NzhWTVW+AMLA7/uFYsW 3T/BYvU/gJqNEvCPgPnFD43DGb0mjwMkoU1dLWAa86fW1NXUbGDQKz8RHdsPY0ghufVl/AQnB2g 4XXp/zKvyd4HE+5299GZc+1ULl5o6lCuY0sa2C6KXLSwSVcwkwaA3O6eR8U2LwJ5wvbmbfCaHpv uYgeuJVz9JxAN1KNzwk9Llu3YNfYpzHW5cHtfsiL4YWdFxm2fWY0Crg1xmwqnLddUSdrpO48hvD bi7YSpTB3UhLPCjajHD/27lUGQKCDOnrMGeMIiKv5ChSsDZeBadQHV+d10lykPDLmtvWrXunRGc 02uFef06om95IBzL5D+lt/4PaNdptg== X-Proofpoint-GUID: nQHFjSBWeeQlJQBfv4pqZ1Y3v9dZ0TGr X-Stat-Signature: p61db6x81f1pwh9aokef6n4gtzno6rik X-Rspam-User: X-Rspamd-Queue-Id: 262EFC000C X-Rspamd-Server: rspam01 X-HE-Tag: 1762426000-154246 X-HE-Meta: U2FsdGVkX18Lf6ijJv5KZ5qko30x+TH0pYwhYQvVy88mNwJqCdcgsWtqu185VOPP3v35a6G2a2yiyRqFW2/8RCgtmYnN+93YimxJy2CiuYILfQMA3k7Ie5qo54NQpY7+dOcK1KMEWcvPI8iaC1SPAv07gEn+1mPoqUMlXbvWI6s32VdmxUlvLsFzn67iBMdjE8dMolENLWtOouBWwL28jVwk9K/Jh9z+6ycJBHbZN9l47Vg+mz8Nm2M2fIe28SIKqNHC3F5pt7/qq+xWSEfjPhPWkYOv659RMnD2XY16lGiw7tlTuY6c8Mh7xXzSC+rTN8ks8SM84HgnljESVlPmdTDXZQHQ0bcZ9nFG5bQvNE2P0vQypuZKjI+aqMg4+GtrNroxEkDzjI/VSgjdDLyDRnrM7S1TuzutMnu91ZwLAS11p4hAckoTQQwefVcWdjtpw4cTHEyr62A3yuGYUGroLH54dTfoQU++ETWdHk8HdRmpQb+6UzToBnd8DvfmUwivRvSElruqH6jEI+dScDWFjt59cNkc0d4LEdqJbqYWhLVDotbhz0JZg2V6bqnH6dySn3wQRFk7j4pykDEn/ttDw2njUJaaAmoRRrO4eoHZlHitDezDGiMhLScelzX7HBwuc+PkKbmxUSTksItdnpq3HQ211ut/9aOJDD6fs7ViBRn2rcSx6cenD/i78w9axuutP4HJcoNYIKkM48sUz6QnLyD4aulKCHpvnhOKjStAy7jXt47qUdToa0K+I/jQuIeA7ddRAbMFtAKKxt5kxrQZAI357rkUSGieZwjs9X/2rshIqyI2g1w8GiJtiEchN3yjM1d/D3P1PwfSkSsKrvDbwPjDGYhGBNbGfoyAfL8XUx4iC6f+0HTUnOTzr6KiUSLNa+WBFgDVfvZV3D7Yr1CVWJcE0grnbxuahK2m9Ov+uw18KcMUGf/xYQpDY3O9DjDWk6aYyKaJiltN2Ujmtp5 lcd950i3 ExQ+LBHw5vbCd3gkIYG2DQ1e1S9P0CnB2IT6y/hh6uzfR5pu1b/lHjfBuwBXMWGXcKKHsml/8jCTTEdTTx7AYncIK0bO1iN4JajyroSaprP4XIoZLBg+p4zo9smnyctA/NUfu2rq2qm5zHMXROpomZykjHJPhs5cdaJXnOdIEXSG+bxCfm3XeAwyBY6DUbMxuV2aqSm3F9MNjlT8Fh0D8liH1mSXY58KgAHDxQJoDq3KE4BEoVR574WbhBSh6zLBy+s7ZGR3QsTNsrz/ngqFC7WKaA6WyT2wBIvHABdfm8x+iZ/fQC9bOShtU4AhNP5TEZyvdb7F7VfkPIAfP+OUZHMoVnCdCcriwdl1Q+QxPBj03Rq6OXLbGQB/kmranCyStn175FLFzV2JBDwaq5n+T1p0kfWgOZ6kn3Hd//W6Q3Mb37rgMc2MK9DXYk1Pe7JkrT5XK+hi4Qcv8xY13BXnw3LagqN0nHfqqLxGhDgEfjzPWmrzhQnbjRnqwK8OAa6RLGeVD+kXi2TzW34TRXjM1YrgP5bpuQEAHw4QBkz+Tx0fYLd1iovYKuEAu747zgYrV1z1bCBGHQfgamyzRdHgh5kkrRzLE4p99T1Te 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: It's useful to be able to force a VMA to be copied on fork outside of the parameters specified by vma_needs_copy(), which otherwise only copies page tables if: * The destination VMA has VM_UFFD_WP set * The mapping is a PFN or mixed map * The mapping is anonymous and forked in (i.e. vma->anon_vma is non-NULL) Setting this flag implies that the page tables mapping the VMA are such that simply re-faulting the VMA will not re-establish them in identical form. We introduce VM_COPY_ON_FORK to clearly identify which flags require this behaviour, which currently is only VM_MAYBE_GUARD. Any VMA flags which require this behaviour are inherently 'sticky', that is, should we merge two VMAs together, this implies that the newly merged VMA maps a range that requires page table copying on fork. In order to implement this we must both introduce the concept of a 'sticky' VMA flag and adjust the VMA merge logic accordingly, and also have VMA merge still successfully succeed should one VMA have the flag set and another not. Note that we update the VMA expand logic to handle new VMA merging, as this function is the one ultimately called by all instances of merging of new VMAs. This patch implements this, establishing VM_STICKY to contain all such flags and VM_IGNORE_MERGE for those flags which should be ignored when comparing adjacent VMA's flags for the purposes of merging. As part of this change we place VM_SOFTDIRTY in VM_IGNORE_MERGE as it already had this behaviour, alongside VM_STICKY as sticky flags by implication must not disallow merge. As a result of this change, VMAs with guard ranges will now not have their merge behaviour impacted by doing so and can be freely merged with other VMAs without VM_MAYBE_GUARD set. We also update the VMA userland tests to account for the changes. Note that VM_MAYBE_GUARD being set atomically remains correct as vma_needs_copy() is invoked with the mmap and VMA write locks held, excluding any race with madvise_guard_install(). Signed-off-by: Lorenzo Stoakes --- include/linux/mm.h | 32 ++++++++++++++++++++++++++++++++ mm/memory.c | 3 +-- mm/vma.c | 22 ++++++++++++---------- tools/testing/vma/vma_internal.h | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 12 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 2ea65c646212..4d80eaf4ef3b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -527,6 +527,38 @@ extern unsigned int kobjsize(const void *objp); #endif #define VM_FLAGS_CLEAR (ARCH_VM_PKEY_FLAGS | VM_ARCH_CLEAR) +/* Flags which should result in page tables being copied on fork. */ +#define VM_COPY_ON_FORK VM_MAYBE_GUARD + +/* + * Flags which should be 'sticky' on merge - that is, flags which, when one VMA + * possesses it but the other does not, the merged VMA should nonetheless have + * applied to it: + * + * VM_COPY_ON_FORK - These flags indicates that a VMA maps a range that contains + * metadata which should be unconditionally propagated upon + * fork. When merging two VMAs, we encapsulate this range in + * the merged VMA, so the flag should be 'sticky' as a result. + */ +#define VM_STICKY VM_COPY_ON_FORK + +/* + * VMA flags we ignore for the purposes of merge, i.e. one VMA possessing one + * of these flags and the other not does not preclude a merge. + * + * VM_SOFTDIRTY - Should not prevent from VMA merging, if we match the flags but + * dirty bit -- the caller should mark merged VMA as dirty. If + * dirty bit won't be excluded from comparison, we increase + * pressure on the memory system forcing the kernel to generate + * new VMAs when old one could be extended instead. + * + * VM_STICKY - If one VMA has flags which most be 'sticky', that is ones + * which should propagate to all VMAs, but the other does not, + * the merge should still proceed with the merge logic applying + * sticky flags to the final VMA. + */ +#define VM_IGNORE_MERGE (VM_SOFTDIRTY | VM_STICKY) + /* * mapping from the currently active vm_flags protection bits (the * low four bits) to a page protection mask.. diff --git a/mm/memory.c b/mm/memory.c index 334732ab6733..7582a88f5332 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1480,8 +1480,7 @@ vma_needs_copy(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma) if (src_vma->anon_vma) return true; - /* Guard regions have momdified page tables that require copying. */ - if (src_vma->vm_flags & VM_MAYBE_GUARD) + if (src_vma->vm_flags & VM_COPY_ON_FORK) return true; /* diff --git a/mm/vma.c b/mm/vma.c index 0c5e391fe2e2..6cb082bc5e29 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -89,15 +89,7 @@ static inline bool is_mergeable_vma(struct vma_merge_struct *vmg, bool merge_nex if (!mpol_equal(vmg->policy, vma_policy(vma))) return false; - /* - * VM_SOFTDIRTY should not prevent from VMA merging, if we - * match the flags but dirty bit -- the caller should mark - * merged VMA as dirty. If dirty bit won't be excluded from - * comparison, we increase pressure on the memory system forcing - * the kernel to generate new VMAs when old one could be - * extended instead. - */ - if ((vma->vm_flags ^ vmg->vm_flags) & ~VM_SOFTDIRTY) + if ((vma->vm_flags ^ vmg->vm_flags) & ~VM_IGNORE_MERGE) return false; if (vma->vm_file != vmg->file) return false; @@ -808,6 +800,7 @@ static bool can_merge_remove_vma(struct vm_area_struct *vma) static __must_check struct vm_area_struct *vma_merge_existing_range( struct vma_merge_struct *vmg) { + vm_flags_t sticky_flags = vmg->vm_flags & VM_STICKY; struct vm_area_struct *middle = vmg->middle; struct vm_area_struct *prev = vmg->prev; struct vm_area_struct *next; @@ -900,11 +893,13 @@ static __must_check struct vm_area_struct *vma_merge_existing_range( if (merge_right) { vma_start_write(next); vmg->target = next; + sticky_flags |= (next->vm_flags & VM_STICKY); } if (merge_left) { vma_start_write(prev); vmg->target = prev; + sticky_flags |= (prev->vm_flags & VM_STICKY); } if (merge_both) { @@ -974,6 +969,7 @@ static __must_check struct vm_area_struct *vma_merge_existing_range( if (err || commit_merge(vmg)) goto abort; + vm_flags_set(vmg->target, sticky_flags); khugepaged_enter_vma(vmg->target, vmg->vm_flags); vmg->state = VMA_MERGE_SUCCESS; return vmg->target; @@ -1124,6 +1120,10 @@ int vma_expand(struct vma_merge_struct *vmg) bool remove_next = false; struct vm_area_struct *target = vmg->target; struct vm_area_struct *next = vmg->next; + vm_flags_t sticky_flags; + + sticky_flags = vmg->vm_flags & VM_STICKY; + sticky_flags |= target->vm_flags & VM_STICKY; VM_WARN_ON_VMG(!target, vmg); @@ -1133,6 +1133,7 @@ int vma_expand(struct vma_merge_struct *vmg) if (next && (target != next) && (vmg->end == next->vm_end)) { int ret; + sticky_flags |= next->vm_flags & VM_STICKY; remove_next = true; /* This should already have been checked by this point. */ VM_WARN_ON_VMG(!can_merge_remove_vma(next), vmg); @@ -1159,6 +1160,7 @@ int vma_expand(struct vma_merge_struct *vmg) if (commit_merge(vmg)) goto nomem; + vm_flags_set(target, sticky_flags); return 0; nomem: @@ -1902,7 +1904,7 @@ static int anon_vma_compatible(struct vm_area_struct *a, struct vm_area_struct * return a->vm_end == b->vm_start && mpol_equal(vma_policy(a), vma_policy(b)) && a->vm_file == b->vm_file && - !((a->vm_flags ^ b->vm_flags) & ~(VM_ACCESS_FLAGS | VM_SOFTDIRTY)) && + !((a->vm_flags ^ b->vm_flags) & ~(VM_ACCESS_FLAGS | VM_IGNORE_MERGE)) && b->vm_pgoff == a->vm_pgoff + ((b->vm_start - a->vm_start) >> PAGE_SHIFT); } diff --git a/tools/testing/vma/vma_internal.h b/tools/testing/vma/vma_internal.h index ddf58a5e1add..984307a64ee9 100644 --- a/tools/testing/vma/vma_internal.h +++ b/tools/testing/vma/vma_internal.h @@ -119,6 +119,38 @@ extern unsigned long dac_mmap_min_addr; #define VM_SEALED VM_NONE #endif +/* Flags which should result in page tables being copied on fork. */ +#define VM_COPY_ON_FORK VM_MAYBE_GUARD + +/* + * Flags which should be 'sticky' on merge - that is, flags which, when one VMA + * possesses it but the other does not, the merged VMA should nonetheless have + * applied to it: + * + * VM_COPY_ON_FORK - These flags indicates that a VMA maps a range that contains + * metadata which should be unconditionally propagated upon + * fork. When merging two VMAs, we encapsulate this range in + * the merged VMA, so the flag should be 'sticky' as a result. + */ +#define VM_STICKY VM_COPY_ON_FORK + +/* + * VMA flags we ignore for the purposes of merge, i.e. one VMA possessing one + * of these flags and the other not does not preclude a merge. + * + * VM_SOFTDIRTY - Should not prevent from VMA merging, if we match the flags but + * dirty bit -- the caller should mark merged VMA as dirty. If + * dirty bit won't be excluded from comparison, we increase + * pressure on the memory system forcing the kernel to generate + * new VMAs when old one could be extended instead. + * + * VM_STICKY - If one VMA has flags which must be 'sticky', that is ones + * which should propagate to all VMAs, but the other does not, + * the merge should still proceed with the merge logic applying + * sticky flags to the final VMA. + */ +#define VM_IGNORE_MERGE (VM_SOFTDIRTY | VM_STICKY) + #define FIRST_USER_ADDRESS 0UL #define USER_PGTABLES_CEILING 0UL -- 2.51.0