From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.48.53 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795021331; b=Ie5vBOOYqZdkyoH5iAP8V/Rs0Az1k7LMCVDN/kCn4AsdGK7OU+I7FR9yyh3sAXVXHfcN Z03uhdATSJb9AjFlGzRxQWhxCEFM6kEdN6WPqa6+YTKGQyqiBxeKes7T4fTJRKThHgBrz EI3WCyienJWT/OuBmqCYLBYZCBtnofYakETuAkx+2wcxaZIAeXKTDN3UfHksPTFElp49P Ovc6MOgBfSM6atc7XT2kxpwjXXEvNFOQPVlTM6oEfPGS8CJOnVzUn3nZ4BMnGBxKi+TVq sZEk3Wg+exDHRiLNkAaK7d/oDezeDsv0qB6I//Yxxd5bxWIyY4U9Qyz+KFuoLF+d4Mw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795021331; h=DMARC-Filter:DKIM-Signature:Received:Received:From:To:Cc:Subject: Date:X-Mailer:Message-ID:In-Reply-To:References:Content-Type: Content-Transfer-Encoding:X-MS-Reactions:X-ClientProxiedBy: MIME-Version:X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=+LnS2wCZZHURH1O6WKOvzj8Jt7ypHJB7p4O6pU8YzsY=; b=seYijX+WlbG2xV2paR00IMNtvMzwvATnIacvK075whF2mrUWZ2x+hfQQ7Q2JJCeeC97O eh8gIj4WlTxXdVvGOMTCzlxcNkPsX94Y50mPUJ/3blXMy2pgqNanuokmHVVYj6Q68otiy CFzTac1CypPOGHp10Gt6WfAVIbtXxwymrjuKhk4EFVSSmkhP/sdCii3XVFT+wd6fbAjzz 3KGbcHSaz5D06K1OKFnsnO8aO8+fiSk37JPPg+Z1QsLUNuRSM60Juu3rxg6k4JU9L6iJV CViVgoSmhNY+uolaUAbzXei/xNz29l2XSUbnreBhj9oJeZON7AtlnvJe/gsX8/U0nOw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=CAs83lxx; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.48.53 Received: from MW6PR02CU001.outbound.protection.outlook.com (mail-westus2azon11012053.outbound.protection.outlook.com [52.101.48.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFBFD606A332; Wed, 18 Nov 2026 17:02:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DFBFD606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=CAs83lxx ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m4Mz4Q+tATCDvMMXXL2FCPqcMxK6GvmGp8arGUL00SBNsQU/MyiEzzSCZDdSQ0ibSXSgFIzb6YJF04Q15GsPempNtNg+hXvHbd7p0YOGfvVbAnRHpZn/T/x6bM7eaxgDs6kt2sqWqp5MVW+dYkX42TYmFzGhemkxj/P+AcClG20OB5l7ZPBxwsxb5kN/5IOCWCSvYQpuh9FpmKVQHDevdxg8MepTjKI3FLG0gjSYnmDXVEEdNcgLeKEOGSsGyZkKXfVTzE3BamxrZrUKH50zSNkHcxjlSBP/gHSmQhmKEACw2VQiFMnMw7YVyNPNkNz7YD2/CDBOOSV5BR157cHWGg== 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=+LnS2wCZZHURH1O6WKOvzj8Jt7ypHJB7p4O6pU8YzsY=; b=WHqli8XbBbEJSEjC2q5p0eypcd9gKb8Y9e27dWmgao+Ra2UNYEoeX3PsAQ3RE+oSKks7VX1iV9Tv/Bu6GlTZRjD9q+f8bMDoETFLsOE59O+Pxnbp93eK63tSAk0FBJmPYY0nAwRxQkWA876gB4x2h+i5TEt1vW9FlGwcYXuu8URTPpKmnFFDqomqrAtYoetCQ874qtu7z+7TzX6GAmzMDuWEX6t9uedUh2g7VW2StvpRDbH3+evMiE9hYoKEJAxhyndbnV0Of8HUbqz6RUBh1Zzq2mBny82Lc65FjS3PJYYFX4RTQchL3Eqma4w0EWGjq10oU0B3/7N0sSih4UyPCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+LnS2wCZZHURH1O6WKOvzj8Jt7ypHJB7p4O6pU8YzsY=; b=CAs83lxx/4T8vWgn99pbYVHoPelbq4SGEsDBMh4pRpc7/VmYYYSK41x3IzrcAKnvxCagoo7qB69CpaucyvV4G8IH4udnoC3/VIL20kXPZIyba/FBAWQHx0vCvS8X6RLu0YrAV0L+tviJbyeksXAZGS9Us/tcC5abqBi5TCykaVwE6cf/Imy/0eZNrNIpy5EIhQrIhzaQaJx7grjL7lHC6qkkWcOWoVajq/+yC67PYJa/hgGqEP5bSi6nIFrpSYB+AieiuVbd3SvSIFZQZqkMitVy7LnF0ONuyUcql9A15X4h5sHKPcqnmVoEtqg2TI7mUk6W+Xz+J+oO+Lw4mgAINA== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA0PR12MB8374.namprd12.prod.outlook.com (2603:10b6:208:40e::7) by LV2PR12MB999096.namprd12.prod.outlook.com (2603:10b6:408:353::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.14; Wed, 18 Nov 2026 17:02:06 +0000 Received: from IA0PR12MB8374.namprd12.prod.outlook.com ([fe80::d85f:4c87:ae84:3f16]) by IA0PR12MB8374.namprd12.prod.outlook.com ([fe80::d85f:4c87:ae84:3f16%6]) with mapi id 15.21.0615.009; Wed, 18 Nov 2026 17:02:06 +0000 From: Zi Yan To: Andreas Hindborg Cc: Andrew Morton , Vlastimil Babka , Lorenzo Stoakes , "Liam R. Howlett" , Uladzislau Rezki , David Hildenbrand , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Mike Rapoport , Joshua Hahn , Rakie Kim , Gregory Price , Ying Huang , Matthew Wilcox , Danilo Krummrich , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Trevor Gross , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= , Greg Kroah-Hartman , =?utf-8?b?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , Christian Brauner , Carlos Llamas , Igor B , Vitaly Wool , linux-mm@kvack.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v22 0/6] rust: page: add page kinds Date: Wed, 18 Nov 2026 12:02:01 -0500 X-Mailer: MailMate (3.0r7038) Message-ID: <37B6D4A8-288E-40E8-9214-EDABBFE49C39@nvidia.com> In-Reply-To: <20261118-page-ownable-v22-0-d63ff73f4075@kernel.org> References: <20261118-page-ownable-v22-0-d63ff73f4075@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-MS-Reactions: disallow X-ClientProxiedBy: CH0PR03CA0346.namprd03.prod.outlook.com (2603:10b6:610:11a::32) To IA0PR12MB8374.namprd12.prod.outlook.com (2603:10b6:208:40e::7) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA0PR12MB8374:EE_|LV2PR12MB999096:EE_ X-MS-Office365-Filtering-Correlation-Id: 69ba2bcf-5d9c-4bd3-29ed-08df4595acce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|1800799024|376014|23010399003|22082099003|18002099003|261022105027099003|261021121427099003|261026140227099003|261026121527099003|261102123227099003|261028144727099003|11063799006|5023799004|56012099006|10067099003; X-Microsoft-Antispam-Message-Info: IZzlUV/5ke4F0dB7PLV0hxRKPi2xTZvsfSAO7QJj1nZDuSEwDRIHQ8we2N8ZyjsPpOrikfxX9FWNM3qD8pvLQ/Cmlh5rih6aLhZZlK1//VFkK+caCzQ77QVwVDvFdfTmU9PBftCILl3cufhW3N0RyhhYVtXvuq8qo8fnKodLIaHVb4Oyhy87w8TRBETpTjdOie/Ct3r3b3/38AHj3SD22zIXdipvzB9xX7nxaIEfVisOnVv7SMs8wPn0mn58tbZnMIeT/8sP2MvrHMRmrgdy1UR5vyknqs4fpfG/B0FxRT3f1/1dFLCsZFOHrqV0sLCTgad7ZD3gurvrmQFQzkiMz0F2OvK8nFhslYMOFYuu9s0uDSMncO3KLG7p3y8VQ3ATmYUY9UHHpLqYGLrnxP4Nl1NR9EEXkJkHhwH986lVJCPyMfPGy0Bjj5pe5Ks7cX9IlN7uDyHQ+m12mDxCHI3hu4uDYLGmEpqj/wfvEZK1WPAT5HDB2SDXAWLHJwJBFsk2+rz7jpQ+heNJJI2nN7sv6KpClzgyrBIeYrYI36W4LObAwN2ADI1jj1HQyaCzHEKdEeH7GAu5Szce6Xg5whUpG4sH/V5ui9OX3TfHKaeOirsd01eK8eVqnQG+eRWy+YsMMY2d8HUzJ+pq9/ZuMWv6kEmWu8vRRnOQTXcRzH5n7dQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA0PR12MB8374.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(1800799024)(376014)(23010399003)(22082099003)(18002099003)(261022105027099003)(261021121427099003)(261026140227099003)(261026121527099003)(261102123227099003)(261028144727099003)(11063799006)(5023799004)(56012099006)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NUo2anB6aVBFRTNMcEJKSDlJQkFWeVVCSWxnanNEV2JMYXV4QjJXaGNsZTZx?= =?utf-8?B?TGFrR2FhbEFhKzU5M1JjMEZ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B?bnlFM1NLWk1CUEwwaXZyOXZOU0ttbGhlRVJVQnYyTmxZcUJyRmR0NmM5cG8x?= =?utf-8?B?QWdqSVFpdW5TVlVCOXo2anduS1hQNVNiWmR1SWl1b1NyQ2x3TXlLazZFdTRa?= =?utf-8?B?MjVxWnErVjBkZmJKZW9YODVEWEt2dWZjb3ZWajNKckgwTHV6d09BTWlqTTB5?= =?utf-8?B?Zk1OWnpCc1dUWFNqN2hCb3VVc1VVZUVnVUQ4TExROWZoVTBoMlZaSGlyNGUy?= =?utf-8?B?dENXczdOUkp0dlhRcEhHRVhZYzdCL2hQdUVZYXBOZzRvTGdESTI4TllYZk9w?= =?utf-8?B?VW5iTk4vRkpNVERzbHlNSWNDSllGSmtWNDlyVFVXenYxelBUcU1abDQ0OUYy?= =?utf-8?B?cFo5Y1ltNVRpbkZoSnEzYUJsMHIxb2p2US95SEE2eDVpb0FuajJvT0JjZFBB?= =?utf-8?B?czNhWHhiWUNRRXdiWFRVODE0QnNJMzN6dVIwb1NIYnVvYTFxdXZXUT09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69ba2bcf-5d9c-4bd3-29ed-08df4595acce X-MS-Exchange-CrossTenant-AuthSource: IA0PR12MB8374.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2026 17:02:06.2943 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: N3lgXYpESyVcTlfRg9x9B1QHSBbXGRHt5JIAWLIaMjDTQObY71TUI3hDCU+ccyYS X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB999096 On 18 Nov 2026, at 11:18, Andreas Hindborg wrote: > Note: The page patches were part of the `Ownable` series [1] until v21. > This series continues the version numbering of that series, and it depends > on v22 of that series for `Ownable`, `Owned` and the split of `RefCounted` > and `AlwaysRefCounted`. > > Not all pages can be treated the same way. A page allocated with > `alloc_pages()` is managed by the page reference count, and kernel C code > routinely takes its own references to such a page. A page owned by the > slab allocator must not have references taken to it, but it can still > show up in places such as a bio vector. A frozen page has a reference > count of zero and is exclusively owned by the party that allocated it. > > A single `Page` type cannot describe all of these. This series makes > `Page` generic over a sealed `PageKind` that describes what is known about > the page: > > - `Page` is the base kind. Nothing is known about the page > beyond the validity of the `struct page`. > - `Page` is the default kind. The page is managed by the > page reference count, and `Page` implements > `AlwaysRefCounted`. > - `Page` is a uniquely owned frozen page whose data area > follows standard Rust aliasing rules, so the data is available as > `&[u8]` and `&mut [u8]`. It is handled through > `Owned>` and is the first in-tree user of `Owned`. > - `Page` is a frozen page whose allocation is uniquely owned. > Unlike for `Page`, nothing is known about who accesses the > data of the page, so the data is only available through the unsafe > raw accessors. Why do we need to allocate Page when we can allocate Page? To me, Page is an observed page state from a non-owner point of view. In core-mm, a page is frozen, when its refcount == 0. The code looking at the page knows the page is exclusively owned by others. If the code allocates a frozen page, it will not check its refcount, because the code knows it has the exclusive ownership of the page. To reflect this, the code calling alloc_frozen_pages() should just get Page and if the code encounters a Page and finds it has no refcount, it should convert it to Page or there should be a method that accepts PFN and return Page if the page of the PFN has no refcount, for PFN walkers. “the data” mentioned in Page and Page is struct page data or the data in the physical frame pointed by Page<...>? If it is the former, is it better to use metadata? I am new to Rust, so feel free to correct me. Thanks. :) > > Operations that are valid for any page are available for all page kinds. > All other page kinds dereference to `Page`. The purpose of the > dereference is coercion: a reference to a page of any kind can be passed > to code that takes a `&Page`. > > `Page` is backed by a frozen page, as suggested by Matthew > Wilcox in the review of v21. References cannot be taken to a frozen page, > so the exclusive ownership is upheld by mm rather than only by the Rust > type system. > Best Regards, Yan, Zi