From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,songmuchun@bytedance.com,akpm@linux-foundation.org
Subject: [to-be-updated] mm-sparse-inline-usemap-allocation-into-sparse_init_nid.patch removed from -mm tree
Date: Thu, 10 Sep 2026 16:00:53 -0700 [thread overview]
Message-ID: <20260910230053.994DA1F000FF@smtp.kernel.org> (raw)
The quilt patch titled
Subject: mm/sparse: inline usemap allocation into sparse_init_nid()
has been removed from the -mm tree. Its filename was
mm-sparse-inline-usemap-allocation-into-sparse_init_nid.patch
This patch was dropped because an updated version will be issued
------------------------------------------------------
From: Muchun Song <songmuchun@bytedance.com>
Subject: mm/sparse: inline usemap allocation into sparse_init_nid()
Date: Tue, 25 Aug 2026 16:46:03 +0800
After removing SPARSEMEM_VMEMMAP_PREINIT, sparse_init_nid() no longer
needs the transient sparse_usagebuf state and its helper wrappers.
Allocate the usemap buffer directly in sparse_init_nid(), pass it to
sparse_init_one_section(), and drop sparse_usage_init(),
sparse_usage_fini(), and sparse_init_early_section().
Link: https://lore.kernel.org/20260825084608.47437-13-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: David Laight <david.laight.linux@gmail.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Qi Zheng <qi.zheng@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/mmzone.h | 3 --
mm/sparse.c | 46 +++++----------------------------------
2 files changed, 7 insertions(+), 42 deletions(-)
--- a/include/linux/mmzone.h~mm-sparse-inline-usemap-allocation-into-sparse_init_nid
+++ a/include/linux/mmzone.h
@@ -2223,9 +2223,6 @@ static inline bool pfn_section_first_val
}
#endif
-void sparse_init_early_section(int nid, struct page *map, unsigned long pnum,
- unsigned long flags);
-
#ifndef CONFIG_HAVE_ARCH_PFN_VALID
/**
* pfn_valid - check if there is a valid memory map entry for a PFN
--- a/mm/sparse.c~mm-sparse-inline-usemap-allocation-into-sparse_init_nid
+++ a/mm/sparse.c
@@ -235,42 +235,6 @@ void __weak __meminit vmemmap_populate_p
{
}
-static void *sparse_usagebuf __initdata;
-static void *sparse_usagebuf_end __initdata;
-
-/*
- * Helper function that is used for generic section initialization, and
- * can also be used by any hooks added above.
- */
-void __init sparse_init_early_section(int nid, struct page *map,
- unsigned long pnum, unsigned long flags)
-{
- BUG_ON(!sparse_usagebuf || sparse_usagebuf >= sparse_usagebuf_end);
- sparse_init_one_section(__nr_to_section(pnum), pnum, map,
- sparse_usagebuf, SECTION_IS_EARLY | flags);
- sparse_usagebuf = (void *)sparse_usagebuf + mem_section_usage_size();
-}
-
-static int __init sparse_usage_init(int nid, unsigned long map_count)
-{
- unsigned long size;
-
- size = mem_section_usage_size() * map_count;
- sparse_usagebuf = memblock_alloc_node(size, SMP_CACHE_BYTES, nid);
- if (!sparse_usagebuf) {
- sparse_usagebuf_end = NULL;
- return -ENOMEM;
- }
-
- sparse_usagebuf_end = sparse_usagebuf + size;
- return 0;
-}
-
-static void __init sparse_usage_fini(void)
-{
- sparse_usagebuf = sparse_usagebuf_end = NULL;
-}
-
/*
* Initialize sparse on a specific node. The node spans [pnum_begin, pnum_end)
* And number of present sections in this node is map_count.
@@ -280,8 +244,11 @@ static void __init sparse_init_nid(int n
unsigned long map_count)
{
unsigned long pnum;
+ struct mem_section_usage *usage;
- if (sparse_usage_init(nid, map_count))
+ usage = memblock_alloc_node(map_count * mem_section_usage_size(),
+ SMP_CACHE_BYTES, nid);
+ if (!usage)
panic("Failed to allocate usemap for node %d\n", nid);
for_each_present_section_nr(pnum_begin, pnum) {
@@ -297,9 +264,10 @@ static void __init sparse_init_nid(int n
panic("Failed to allocate memmap for section %lu\n", pnum);
memmap_boot_pages_add(section_nr_vmemmap_pages(pfn, PAGES_PER_SECTION,
NULL, NULL));
- sparse_init_early_section(nid, map, pnum, 0);
+ sparse_init_one_section(__nr_to_section(pnum), pnum, map, usage,
+ SECTION_IS_EARLY);
+ usage = (void *)usage + mem_section_usage_size();
}
- sparse_usage_fini();
}
/*
_
Patches currently in -mm which might be from songmuchun@bytedance.com are
mm-sparse-remove-section_map_size.patch
mm-hugetlb-remove-huge_bootmem_hvo.patch
mm-hugetlb-remove-huge_bootmem_cma.patch
mm-hugetlb-localize-struct-huge_bootmem_page.patch
mm-hugetlb-localize-huge_bootmem_zones_valid.patch
mm-sparse-vmemmap-introduce-config_sparsemem_vmemmap_optimization.patch
mm-sparse-vmemmap-factor-out-shared-vmemmap-tail-page-allocation.patch
mm-sparse-vmemmap-open-code-init_compound_tail.patch
mm-sparse-vmemmap-prepare-dax-vmemmap-population-for-section-orders.patch
mm-sparse-vmemmap-set-section-order-for-device-dax.patch
mm-sparse-vmemmap-switch-device-dax-to-shared-tail-vmemmap-pages.patch
mm-sparse-vmemmap-move-hvo-helpers-to-a-public-header.patch
powerpc-mm-switch-device-dax-to-shared-tail-vmemmap-pages.patch
mm-sparse-vmemmap-drop-the-extra-tail-page-from-device-dax-reservation.patch
mm-sparse-vmemmap-drop-unused-section_nr_vmemmap_pages-arguments.patch
documentation-mm-update-dax-vmemmap-deduplication-docs.patch
reply other threads:[~2026-09-10 23:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260910230053.994DA1F000FF@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=mm-commits@vger.kernel.org \
--cc=songmuchun@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox