From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795514615; b=doZerzftbJNWO+LRnqsjoIBmYHpZ4Pn36YYETk9tSABbREKVQMQKh23cb5T3OLnKmGbR OSMAi1uUTTcIWzB0cxRrIQpOQWEaEamfB4c8lU+zeaXe4jNTfJjShQZMjecyDdNJ95Y2E Z46BWPx+sK8KM0iTgw1UuJiwkbbfjMqedJ+8mDNkjS4/rbNHPS6FQI+n1jkEy7nVuUd9o jcSGYpyZMOiZQ2b0WmNc2CyWovV6/GwiJIa1MVElRC0oSzr/NxGv4SZnH4NXMi2gXXYBD 5HrTPyYZXZENnaCWK3RIv14hqLqYCem/J2onjiSSCOy6hBdAPZKYhxIrIY0K3rEFNcQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795514615; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=wMiMVMJhMi9kWzymZXMN0T4Ky9sOHtB0p03KXvBjkN4=; b=P4/ypkygnCGjUoIvEmcUHdPJfE7fkXc5092CEycQjPTqX7xkZ8Hv2tK7KQ7zzQA6IWkM POzXYKA6CecMDEKzNjukBFUoe6yD3Pv/t0Hjq8SrnsrfkRrgh3IW/dOwI3z/cQGqKSNAS IrB9ERi2pYAcVXP5/Zm3rIpImIpIzq/eimX9rLV9rC4D1oqChhJO7WXkZ0QXJEg7DaEyb zQMyOBiGvuIKMoWbkSYi+6DEFEKmqNhVfAnaPrrUd8JI1FucQbz//UUycj/1CI0vJDfdn jSyelPatBAsLN6UAGvKJjGOybbfg9KROMuVnmVEAjJo6zrvstgBGm+O1DHJ64+kVFdQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=gwDfftwY; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA075606A331 for ; Tue, 24 Nov 2026 10:03:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=gwDfftwY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EAF51F000C4; Tue, 24 Nov 2026 10:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1795514615; bh=wMiMVMJhMi9kWzymZXMN0T4Ky9sOHtB0p03KXvBjkN4=; h=Date:To:From:In-Reply-To:References:Subject; b=gwDfftwY/k0MJ/HfRgvImB6HBe1LOY/mPhgw7MsFuoj0vnsAGcsifDBTQcqfixcGy kCtBNwKOICYaphJwkmyzv2TzjLj7kVIrYsELpkjpf4UTdxmsLwDIepjrxZ8uD/shvV MeP/CBN3zITh+PU3/5ckMcL75oBHtgwHrDCFjSqI= Date: Tue, 24 Nov 2026 02:03:34 -0800 To: mm-commits@vger.kernel.org,ziy@nvidia.com,vbabka@kernel.org, surenb@google.com,smostafa@google.com,skhan@linuxfoundation.org, rppt@kernel.org,rdunlap@infradead.org,praan@google.com,mhocko@suse.com, liam@infradead.org,ketan.kishore@oss.qualcomm.com,joerg.roedel@amd.com, hannes@cmpxchg.org,glider@google.com,elver@google.com,ekffu200098@gmail.com, dvyukov@google.com,david@kernel.org,corbet@lwn.net,chris@chrisdown.name, brendan.jackman@linux.dev,baolu.lu@linux.intel.com,songmuchun@bytedance.com, akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261119065812.89959-5-songmuchun@bytedance.com> References: <20261119065812.89959-5-songmuchun@bytedance.com> Subject: + mm-page_ext-use-common-allocation-and-initialization-entry-points.patch added to mm-new branch Message-Id: <20261124100335.2EAF51F000C4@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The patch titled Subject: mm/page_ext: use common allocation and initialization entry points has been added to the -mm mm-new branch. Its filename is mm-page_ext-use-common-allocation-and-initialization-entry-points.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-page_ext-use-common-allocation-and-initialization-entry-points.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Muchun Song Subject: mm/page_ext: use common allocation and initialization entry points Date: Thu, 19 Nov 2026 14:58:09 +0800 FLATMEM uses separate page_ext_init_flatmem() and page_ext_init_flatmem_late() entry points, while SPARSEMEM performs its work through page_ext_init(). This exposes the memory model in the generic boot sequence and obscures the allocation and client initialization phases. Rename the early entry point to page_ext_alloc() and use page_ext_init() for client callbacks in both memory models. SPARSEMEM keeps its existing late allocation behavior for now; its page_ext_alloc() remains an empty configuration stub. This also moves FLATMEM client callbacks from immediately after kmem_cache_init() to after vmalloc_init(). The callbacks still run after the buddy and slab allocators are available, as required by page_owner. Link: https://patch.msgid.link/20261119065812.89959-5-songmuchun@bytedance.com Signed-off-by: Muchun Song Signed-off-by: Andrew Morton Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Chris Down Tested-by: Chris Down Cc: Alexander Potapenko Cc: Marco Elver Cc: Dmitry Vyukov Cc: David Hildenbrand Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Suren Baghdasaryan Cc: Michal Hocko Cc: Johannes Weiner Cc: Brendan Jackman Cc: Zi Yan Cc: Joerg Roedel Cc: Lu Baolu Cc: Pranjal Shrivastava Cc: Ketan Cc: Mostafa Saleh Cc: Sang-Heon Jeon Cc: Jonathan Corbet Cc: Shuah Khan Cc: Randy Dunlap include/linux/page_ext.h | 20 +++++--------------- mm/mm_init.c | 7 +------ mm/page_ext.c | 5 ++--- 3 files changed, 8 insertions(+), 24 deletions(-) --- a/include/linux/page_ext.h~mm-page_ext-use-common-allocation-and-initialization-entry-points +++ a/include/linux/page_ext.h @@ -62,13 +62,10 @@ static inline bool early_page_ext_enable } #ifdef CONFIG_SPARSEMEM -static inline void page_ext_init_flatmem(void) -{ -} -extern void page_ext_init(void); -static inline void page_ext_init_flatmem_late(void) +static inline void page_ext_alloc(void) { } +void page_ext_init(void); static inline bool page_ext_iter_next_fast_possible(unsigned long next_pfn) { @@ -79,11 +76,8 @@ static inline bool page_ext_iter_next_fa return next_pfn % PAGES_PER_SECTION; } #else -extern void page_ext_init_flatmem(void); -extern void page_ext_init_flatmem_late(void); -static inline void page_ext_init(void) -{ -} +void page_ext_alloc(void); +void page_ext_init(void); static inline bool page_ext_iter_next_fast_possible(unsigned long next_pfn) { @@ -205,11 +199,7 @@ static inline void page_ext_init(void) { } -static inline void page_ext_init_flatmem_late(void) -{ -} - -static inline void page_ext_init_flatmem(void) +static inline void page_ext_alloc(void) { } --- a/mm/mm_init.c~mm-page_ext-use-common-allocation-and-initialization-entry-points +++ a/mm/mm_init.c @@ -2648,7 +2648,7 @@ void __init mm_core_init(void) * page_ext requires contiguous pages, * bigger than MAX_PAGE_ORDER unless SPARSEMEM. */ - page_ext_init_flatmem(); + page_ext_alloc(); mem_debugging_and_hardening_init(); kfence_alloc_pool_and_metadata(); report_meminit(); @@ -2664,11 +2664,6 @@ void __init mm_core_init(void) memblock_free_all(); mem_init(); kmem_cache_init(); - /* - * page_owner must be initialized after buddy is ready, and also after - * slab is ready so that stack_depot_init() works properly - */ - page_ext_init_flatmem_late(); kmemleak_init(); ptlock_cache_init(); pgtable_cache_init(); --- a/mm/page_ext.c~mm-page_ext-use-common-allocation-and-initialization-entry-points +++ a/mm/page_ext.c @@ -185,7 +185,7 @@ static inline struct page_ext *get_entry } #ifndef CONFIG_SPARSEMEM -void __init page_ext_init_flatmem_late(void) +void __init page_ext_init(void) { invoke_init_callbacks(); } @@ -243,9 +243,8 @@ static int __init alloc_node_page_ext(in return 0; } -void __init page_ext_init_flatmem(void) +void __init page_ext_alloc(void) { - int nid, fail; if (!invoke_need_callbacks()) _ Patches currently in -mm which might be from songmuchun@bytedance.com are powerpc-mm-make-vmemmap_populate_compound_pages-static.patch powerpc-mm-drop-powerpc-vmemmap_can_optimize.patch mm-sparse-vmemmap-drop-vmemmap_can_optimize.patch mm-sparse-vmemmap-drop-pgmap-from-vmemmap-population-apis.patch mm-hugetlb_vmemmap-fix-hwpoison-state-races-during-optimization.patch mm-hugetlb_vmemmap-fix-pmd-split-tlb-flush-race.patch mm-hugetlb_vmemmap-fix-deadlock-during-pmd-split.patch mm-list_lru-fix-potential-infinite-loop-on-xa-node-allocation-failure.patch mm-mm_init-verify-zones-for-template-initialized-pages.patch mm-mm_init-factor-out-common-struct-page-initialization.patch mm-mm_init-simplify-zone-device-page-initialization.patch mm-mm_init-factor-out-compound-page-initialization.patch mm-hugetlb-drop-boot-time-hvo-handling-for-gigantic-folios.patch mm-hugetlb-initialize-all-struct-pages-for-bootmem-hugepages.patch mm-hugetlb-use-common-compound-page-initialization-helper.patch mm-mm_init-make-__init_single_page-static.patch mm-cma-centralize-cma-pageblock-initialization.patch mm-cma-localize-init_cma_pageblock-to-cmac.patch mm-mm_init-move-pageblock-migratetype-init-to-memmap-helpers.patch kmsan-encapsulate-per-page-metadata-access.patch mm-page_ext-fix-client-data-alignment.patch mm-page_ext-always-use-vmalloc-for-section-page-extensions.patch mm-page_ext-use-common-allocation-and-initialization-entry-points.patch mm-page_ext-allocate-page-extensions-early-for-sparsemem.patch mm-page_ext-inline-unchecked-page-extension-lookup.patch kmsan-fix-metadata-loss-during-hugetlb-struct-page-reinitialization.patch