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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BDB0FC44536 for ; Wed, 22 Jul 2026 15:28:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28FE910E496; Wed, 22 Jul 2026 15:28:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.b="ccraX+XG"; dkim-atps=neutral Received: from CH1PR05CU001.outbound.protection.outlook.com (mail-northcentralusazon11010003.outbound.protection.outlook.com [52.101.193.3]) by gabe.freedesktop.org (Postfix) with ESMTPS id F13CC10E462; Wed, 22 Jul 2026 15:28:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hPOW1fTVx2Wuans8dJa8ce/fsd00QbbmVAR0uvVdnSWtDnSHT6/GXo5yN/M1QI7uEWMEi/vx571U43yra5WhkLSXNbtTPMkmcO1oBEyiUvD6URe6UioUX3r3qgCW/9+4DOLc1NYdmOfOn+HQdtRYclB5pDweSgx78/P0VRABSzQU1jZE7TzN4MfYZo8fJY4VZRQgf7nNl7v5TICQJkSlyiIp10Q9cqvOzXDCf9foPbZYf8y8liVUy90AFFe+E4zMhelPzeuGg15k19EcsoTowt6TvuLnmbiKP+AIG1CFtaB6IMOpasDcc9NyJ3hKWCBOYb0pCIQJlwWPr1ON35JBdA== 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=QqRZL/rt0dpnEKkm7K2rlY2ObLEkb0mChA17+uCwGnU=; b=u3Lcnd2arCfNNzaIR1NAV7K3OUWs/+vA2ChX4TVhfYXm1uf95apNN7ZAVcYHhN0K+Q+9AW2+dFPNtfjb3VycNRgWjKdKZv9W4gV4jJ1MjCus6j5R6MY73HqUSGoFRkEkGv0CERathAfjfLj+bOqlvjNBmGQNFfoq1R2BPkEH2LoBaDDlfF/UMqawJDDpF+9u0sHRglxY4ZCk2HbcFhWGUAR2J1vYZ0LQ3D/8M1/5dv3mSJlIH5XVXnP2gm3UrxaolZMc6Kf5HbVNvKzlruPWl9g20ibyFqARHHZConafkheKVnzWi6Z1cRVEai/w1vcAtxalDn9AJNWubkIp7/is7Q== 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=QqRZL/rt0dpnEKkm7K2rlY2ObLEkb0mChA17+uCwGnU=; b=ccraX+XGob2V/oIUoPe4s1hI+hG78PRdhMaFKEyY0rJg3iCll5nuFs2NjjmdTN7XJ7DiGP4HuRrj2HPo/U42TcdfKagu8DJZXnYo2XF10gLXgNL/9HKj708rhavCpd1ir3fT8gxx8HM+JxCKKPjDbkKyqiFsxeA+PcOcK5jlNXxZK3n6aIMWJHLcqEUHkjkd9dLcEIdfIzCU+qjoCSN5VFAHle6eI7Vz5Ir9EWdauxHM6tRV62WZwgGh8b1oRR66b8zaYFbq44cL7kh92Ejj7G7AfxmUrQ2XcGrGPATBv2eWc9LcmioyuBqU7YVjW+ZDvpEjZLjMWLONYJTSeWPAXg== Authentication-Results: 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 MW3PR12MB4380.namprd12.prod.outlook.com (2603:10b6:303:5a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.10; Wed, 22 Jul 2026 15:28:34 +0000 Received: from IA0PR12MB8374.namprd12.prod.outlook.com ([fe80::d85f:4c87:ae84:3f16]) by IA0PR12MB8374.namprd12.prod.outlook.com ([fe80::d85f:4c87:ae84:3f16%5]) with mapi id 15.21.0245.009; Wed, 22 Jul 2026 15:28:34 +0000 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 22 Jul 2026 11:28:31 -0400 Message-Id: To: "Matthew Brost" , , , , From: "Zi Yan" Subject: Re: [PATCH 1/3] mm/huge_memory: add folio_split_driver_managed() Cc: "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Simona Vetter" , "Christian Koenig" , "Huang Rui" , "Matthew Auld" , "Andrew Morton" , "David Hildenbrand" , "Lorenzo Stoakes" , "Baolin Wang" , "Liam R. Howlett" , "Nico Pache" , "Ryan Roberts" , "Dev Jain" , "Barry Song" , "Lance Yang" , "Tvrtko Ursulin" , "Dave Airlie" , "Matthew Wilcox" X-Mailer: aerc 0.21.0 References: <20260722044220.1110278-1-matthew.brost@intel.com> In-Reply-To: X-ClientProxiedBy: DS7PR03CA0133.namprd03.prod.outlook.com (2603:10b6:5:3b4::18) To IA0PR12MB8374.namprd12.prod.outlook.com (2603:10b6:208:40e::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA0PR12MB8374:EE_|MW3PR12MB4380:EE_ X-MS-Office365-Filtering-Correlation-Id: 797603bc-a8c8-4e98-04be-08dee805e499 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|1800799024|366016|23010399003|376014|4143699003|56012099006|10067099003|11063799006|5023799004|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: rH6EkIaP9s70ljS4cZWYXQgsC3+UUuAkektu5SJi3GH1qCm21IHW6rgfbBttNaq6mhmk9Hv7GTrjrwvpRThksz4LFXrozLmET9KRZ7cpkEAdKLV7eBLYJnQs1sg9n1em6YkmipsKxkLj9rGCCOXOMD8LesW/anLs7jeHDObhMeNaBDVu9ocSnTNmpD14WCw30Lwl8HSmAgzc5mBdCBAkc8WVPUvB4UsrxU83v+ciwpYNQe46i7wyzhC1tcoUtd9eRAt6dkbi43VljyUXOiyqKPpKeZ0tF7WQkCTdqvmK1ylMkbuE1rIOgOFhRVOxpyYDQqHXDVlDw8hKP8U8NC7Pc7k1NbvI12njoBSGOYkJ3DP1J6nfOniTJsMl0pBiNiVkJtUDpvI7WodtF7eEvLnRqzjBDoBgYOjQSOrv4eY3rZiHq0aRe/5S3HHcmtDUnamXC5sOvf4mHON4CABkdBjmzxxCdletT3D3vPPk+iRK9FQVtGjgFg8kLDrP8uZrfYz2O+WP/PRQO6TlAmezH7vd8X8Hs85vfhNNY4RU56HnlzKz0pHhLJREXNApqW8mVYUjCcKbMNVin/MMdXTl3Ni8DUFC71DbDA1jfJdZvPqItl8UN4sQm8JiqvaR6JbtFZ4+brOZjdY+8t4JOada91xY1toVG4XrV5Ejt9ChGZKJhW4= 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)(7416014)(1800799024)(366016)(23010399003)(376014)(4143699003)(56012099006)(10067099003)(11063799006)(5023799004)(22082099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?b0lBdW5JTVl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G1PbU8rR2kvTU9WUFBHTVQ0?= =?utf-8?B?K3BOQ3E4aWFQNHJrYWtqM2VwNmNhNitxMVc3WURWajBJZjRZeWhEd0JYcWxP?= =?utf-8?B?cmlSNVRLcWhEdGlFUGpRK0NvdTRIOUtJc3JMQXR0TERsSk5iZXlrK2c4YUJZ?= =?utf-8?B?WmwyaXl3cWZQZG9ueTRQYVVtdHhqVUJDNFZ5MlFpUHl0ak9WSWxsdHV2Mk0y?= =?utf-8?B?UXJVMUNVVS9BaWN4cHJRZUJSMFZjMFlOVGw4aitQUEVhL3RGREFNUFRqYUs5?= =?utf-8?B?eTRmVnNFckZCRXZSRlBlV1d4dWUyQnRoQ2h5S2JWY2tsYjMwdGd4cFNzUmtQ?= =?utf-8?B?NWNlTXNpNkZwSWdMTk9uR2dzNEFZMENJd0FSK0dDMTJieU9DdUVlUFcyV08x?= =?utf-8?B?NzQ2Um5vQS9yVmdEWUNqMmIvcGw1cEltSGtSM0NqVkxHVVRnSEFuc2ozQ05h?= =?utf-8?B?TVN2ZCtXLzZxY0hQVnBBZGpIeWgxcXZPYmRnNjIyN0htSjdScFltMkpJeUg0?= =?utf-8?Q?FH030KQXhCkTmCiinc?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 797603bc-a8c8-4e98-04be-08dee805e499 X-MS-Exchange-CrossTenant-AuthSource: IA0PR12MB8374.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2026 15:28:34.2426 (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: JWUZE/OYdqnUMUAyfnCirV9ZpQIljwc1lSXxe9ItW5v22gg6Mdct4K9O5OF+i/hB X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4380 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed Jul 22, 2026 at 10:26 AM EDT, Zi Yan wrote: > On Wed Jul 22, 2026 at 12:42 AM EDT, Matthew Brost wrote: >> Add a lightweight structural split primitive for large (compound) folios >> that a driver allocated with __GFP_COMP and manages entirely by itself, >> outside of the core mm's view. >> >> The existing split paths - split_folio() and folio_split_unmapped() - >> are built for folios that the mm owns: they perform a refcount freeze, >> walk and remap the rmap, and take the anon_vma / i_mmap locks, and >> folio_split_unmapped() further assumes an anon, pagecache-style refcount >> model (nr_pages + 1). None of that applies to a folio that is: >> >> - singly referenced (the caller holds the only reference), >> - not mapped through the rmap (folio_mapped() =3D=3D 0), >> - not in the page cache or swap cache (folio->mapping =3D=3D NULL), >> - not on any LRU or the deferred-split list. >> >> For such a folio the split is purely structural: because nothing else in >> the kernel can reach it, there is no need to freeze the refcount or touc= h >> any mapping. folio_split_driver_managed() therefore performs only the > > I do not think so. PFN scanners like memory compaction should be able to > see them, unless you mean something else about "a driver allocated with > __GFP_COMP". You will need to freeze it to prevent the to-be-split > folios being touched by others. > > >> compound and split-accounting teardown via __split_unmapped_folio() and >> then hands each resulting order-@new_order folio its own reference, >> mirroring split_page() for compound folios. The caller keeps the origina= l >> reference on the first resulting folio and is responsible for freeing al= l >> of them individually. >> >> The immediate user is TTM's GPU page pool, which allocates higher-order >> compound pages, maps them into userspace via VM_PFNMAP (never through th= e >> rmap), and needs to split them into order-0 folios under memory pressure >> so pages can be backed up to shmem and freed one at a time. >> >> A CONFIG_TRANSPARENT_HUGEPAGE=3Dn stub is provided so callers can build >> without the split machinery; it warns and returns -EINVAL. >> >> Cc: Maarten Lankhorst >> Cc: Maxime Ripard >> Cc: Thomas Zimmermann >> Cc: David Airlie >> Cc: Simona Vetter >> Cc: Christian Koenig >> Cc: Huang Rui >> Cc: Matthew Auld >> Cc: Matthew Brost >> Cc: Andrew Morton >> Cc: David Hildenbrand >> Cc: Lorenzo Stoakes >> Cc: Zi Yan >> Cc: Baolin Wang >> Cc: "Liam R. Howlett" >> Cc: Nico Pache >> Cc: Ryan Roberts >> Cc: Dev Jain >> Cc: Barry Song >> Cc: Lance Yang >> Cc: Tvrtko Ursulin >> Cc: Dave Airlie >> Cc: dri-devel@lists.freedesktop.org >> Cc: linux-kernel@vger.kernel.org >> Cc: linux-mm@kvack.org >> Suggested-by: Matthew Wilcox >> Signed-off-by: Matthew Brost >> Assisted-by: GitHub-Copilot:claude-opus-4.8 >> >> --- >> >> The patch is based on drm-tip rather than the core MM branches to >> facilitate Intel CI testing and initial review. It can be rebased onto >> the core MM branches in a subsequent revision. >> --- >> include/linux/huge_mm.h | 8 ++++++ >> mm/huge_memory.c | 63 +++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 71 insertions(+) >> >> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h >> index ad20f7f8c179..35661d82d54a 100644 >> --- a/include/linux/huge_mm.h >> +++ b/include/linux/huge_mm.h >> @@ -402,6 +402,7 @@ enum split_type { >> int __split_huge_page_to_list_to_order(struct page *page, struct list_h= ead *list, >> unsigned int new_order); >> int folio_split_unmapped(struct folio *folio, unsigned int new_order); >> +int folio_split_driver_managed(struct folio *folio, unsigned int new_or= der); >> unsigned int min_order_for_split(struct folio *folio); >> int split_folio_to_list(struct folio *folio, struct list_head *list); >> int folio_check_splittable(struct folio *folio, unsigned int new_order, >> @@ -656,6 +657,13 @@ static inline int split_folio_to_list(struct folio = *folio, struct list_head *lis >> return -EINVAL; >> } >> =20 >> +static inline int folio_split_driver_managed(struct folio *folio, >> + unsigned int new_order) >> +{ >> + VM_WARN_ON_ONCE_FOLIO(1, folio); >> + return -EINVAL; >> +} >> + >> static inline int folio_split(struct folio *folio, unsigned int new_ord= er, >> struct page *page, struct list_head *list) >> { >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >> index 2bccb0a53a0a..06f9a5f35df8 100644 >> --- a/mm/huge_memory.c >> +++ b/mm/huge_memory.c >> @@ -4185,6 +4185,69 @@ int folio_split_unmapped(struct folio *folio, uns= igned int new_order) >> return ret; >> } >> =20 >> +/** >> + * folio_split_driver_managed() - split an exclusively-owned, off-LRU f= olio >> + * @folio: folio to split. Must be a large (compound) folio that is own= ed >> + * exclusively by the caller and is invisible to the core mm. >> + * @new_order: the order of the folios after the split. >> + * >> + * This is a lightweight structural split for folios that a driver allo= cated >> + * and manages itself (for example TTM's GPU page pool, which allocates >> + * higher-order compound pages with __GFP_COMP and maps them into users= pace >> + * via VM_PFNMAP rather than through the rmap). Such folios are: Strickly speaking, these vm_insert*() compound pages are not folios, since folios are supposed to be rmappable and they are either anonymous memory or file-backed memory. I am working on separating them from rmappable folios by replacing PG_private with PG_folio and marking all pages in a folio with PG_folio in page_rmappable_folio(). Hopefully, we can find a better name, like refcounted_folio, later for these non-rmappable compound pages. >> + * >> + * - singly referenced (the caller holds the only reference), >> + * - not mapped through the rmap (folio_mapcount() =3D=3D 0), >> + * - not in the page cache or swap cache (folio->mapping =3D=3D NULL)= , >> + * - not on any LRU or the deferred-split list. >> + * >> + * Because nothing else in the kernel can reach the folio, this helper = does >> + * not perform the refcount freeze / remap / anon_vma & i_mmap locking = dance >> + * that split_folio() and folio_split_unmapped() require. It performs o= nly >> + * the compound and split-accounting teardown and then hands each resul= ting >> + * folio its own reference, mirroring split_page() for compound folios. >> + * >> + * The caller is responsible for freeing the resulting folios individua= lly. >> + * >> + * Context: caller holds the only reference and excludes concurrent acc= ess. >> + * Does not sleep. >> + * >> + * Return: 0 on success, negative errno on failure. >> + */ >> +int folio_split_driver_managed(struct folio *folio, unsigned int new_or= der) >> +{ >> + unsigned int old_order =3D folio_order(folio); >> + unsigned int split_nr =3D 1U << new_order; >> + unsigned int nr =3D 1U << old_order; >> + unsigned int i; >> + >> + if (new_order >=3D old_order) >> + return -EINVAL; >> + >> + VM_WARN_ON_ONCE_FOLIO(folio_ref_count(folio) !=3D 1, folio); >> + VM_WARN_ON_ONCE_FOLIO(folio_mapped(folio), folio); >> + VM_WARN_ON_ONCE_FOLIO(folio->mapping, folio); >> + VM_WARN_ON_ONCE_FOLIO(folio_test_swapcache(folio), folio); >> + VM_WARN_ON_ONCE_FOLIO(folio_test_lru(folio), folio); >> + >> + /* >> + * Structural + split-accounting teardown only. No mapping/xarray, no >> + * refcount freeze: the folio is frozen-by-ownership already. >> + */ >> + __split_unmapped_folio(folio, new_order, &folio->page, NULL, NULL, >> + SPLIT_TYPE_UNIFORM); >> + >> + /* >> + * Give every resulting head folio its own reference. The original >> + * reference stays on the first one, exactly like split_page(). >> + */ >> + for (i =3D split_nr; i < nr; i +=3D split_nr) >> + set_page_refcounted(folio_page(folio, i)); >> + >> + return 0; >> +} >> +EXPORT_SYMBOL_GPL(folio_split_driver_managed); >> + >> /* >> * This function splits a large folio into smaller folios of order @new= _order. >> * @page can point to any page of the large folio to split. The split o= peration --=20 Best Regards, Yan, Zi