* [merged mm-stable] mm-sparse-vmemmap-support-section-based-vmemmap-accounting.patch removed from -mm tree
@ 2026-10-07 0:49 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-10-07 0:49 UTC (permalink / raw)
To: mm-commits, vbabka, surenb, rppt, qi.zheng, osalvador, mhocko,
ljs, liam, david.laight.linux, david, songmuchun, akpm
The quilt patch titled
Subject: mm/sparse-vmemmap: support section-based vmemmap accounting
has been removed from the -mm tree. Its filename was
mm-sparse-vmemmap-support-section-based-vmemmap-accounting.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Muchun Song <songmuchun@bytedance.com>
Subject: mm/sparse-vmemmap: support section-based vmemmap accounting
Date: Thu, 10 Sep 2026 14:32:44 +0800
section_nr_vmemmap_pages() can account ordinary sections and DAX sections,
but section-based vmemmap optimization stores the compound page order in
struct mem_section and retains a different number of vmemmap pages.
Teach section_nr_vmemmap_pages() to recognize section-based optimized
sections and calculate their vmemmap page count from the stored compound
page order and the HVO retained page count.
Link: https://lore.kernel.org/20260910063256.64386-6-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Acked-by: Qi Zheng <qi.zheng@linux.dev>
Cc: 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: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
---
include/linux/mmzone.h | 6 ++++--
mm/sparse-vmemmap.c | 10 ++++++----
mm/sparse.h | 16 ++++++++++++++++
3 files changed, 26 insertions(+), 6 deletions(-)
--- a/include/linux/mmzone.h~mm-sparse-vmemmap-support-section-based-vmemmap-accounting
+++ a/include/linux/mmzone.h
@@ -107,8 +107,10 @@
is_power_of_2(sizeof(struct page)) ? \
MAX_FOLIO_NR_PAGES * sizeof(struct page) : 0)
-/* The number of struct pages covered by the retained vmemmap pages with HVO enabled. */
-#define VMEMMAP_OPTIMIZATION_NR_STRUCT_PAGES (PAGE_SIZE / sizeof(struct page))
+/* The number of retained vmemmap pages with HVO enabled. */
+#define VMEMMAP_OPTIMIZATION_PAGES 1
+#define VMEMMAP_OPTIMIZATION_NR_STRUCT_PAGES \
+ (VMEMMAP_OPTIMIZATION_PAGES * PAGE_SIZE / sizeof(struct page))
#define VMEMMAP_OPTIMIZATION_MIN_ORDER (ilog2(VMEMMAP_OPTIMIZATION_NR_STRUCT_PAGES) + 1)
#define __VMEMMAP_OPTIMIZATION_NR_ORDERS \
--- a/mm/sparse.h~mm-sparse-vmemmap-support-section-based-vmemmap-accounting
+++ a/mm/sparse.h
@@ -43,6 +43,17 @@ static inline bool vmemmap_optimizable_p
return (pfn & (nr_pages - 1)) >= VMEMMAP_OPTIMIZATION_NR_STRUCT_PAGES;
}
+static inline bool vmemmap_optimizable_order(unsigned int order)
+{
+ if (!IS_ENABLED(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP))
+ return false;
+
+ if (!is_power_of_2(sizeof(struct page)))
+ return false;
+
+ return order >= VMEMMAP_OPTIMIZATION_MIN_ORDER;
+}
+
/*
* mm/sparse.c
*/
@@ -86,6 +97,11 @@ static inline size_t mem_section_usage_s
return struct_size_t(struct mem_section_usage, pageblock_flags,
BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS));
}
+
+static inline bool section_vmemmap_optimizable(const struct mem_section *ms)
+{
+ return vmemmap_optimizable_order(section_compound_order(ms));
+}
#else
static inline void sparse_init(void) {}
#endif /* CONFIG_SPARSEMEM */
--- a/mm/sparse-vmemmap.c~mm-sparse-vmemmap-support-section-based-vmemmap-accounting
+++ a/mm/sparse-vmemmap.c
@@ -649,24 +649,26 @@ void offline_mem_sections(unsigned long
static int __meminit section_nr_vmemmap_pages(unsigned long pfn, unsigned long nr_pages,
struct vmem_altmap *altmap, struct dev_pagemap *pgmap)
{
- const unsigned int order = pgmap ? pgmap->vmemmap_shift : 0;
+ const struct mem_section *ms = __pfn_to_section(pfn);
+ const int order = pgmap ? pgmap->vmemmap_shift : section_compound_order(ms);
+ const int vmemmap_pages = pgmap ? VMEMMAP_RESERVE_NR : VMEMMAP_OPTIMIZATION_PAGES;
const unsigned long pages_per_compound = 1UL << order;
VM_WARN_ON_ONCE(!IS_ALIGNED(pfn | nr_pages, PAGES_PER_SUBSECTION));
VM_WARN_ON_ONCE(nr_pages > PAGES_PER_SECTION);
- if (!vmemmap_can_optimize(altmap, pgmap))
+ if (!vmemmap_can_optimize(altmap, pgmap) && !section_vmemmap_optimizable(ms))
return DIV_ROUND_UP(nr_pages * sizeof(struct page), PAGE_SIZE);
if (order < PFN_SECTION_SHIFT) {
VM_WARN_ON_ONCE(!IS_ALIGNED(pfn | nr_pages, pages_per_compound));
- return VMEMMAP_RESERVE_NR * nr_pages / pages_per_compound;
+ return vmemmap_pages * nr_pages / pages_per_compound;
}
VM_WARN_ON_ONCE(!IS_ALIGNED(pfn | nr_pages, PAGES_PER_SECTION));
if (IS_ALIGNED(pfn, pages_per_compound))
- return VMEMMAP_RESERVE_NR;
+ return vmemmap_pages;
return 0;
}
_
Patches currently in -mm which might be from songmuchun@bytedance.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-07 0:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-07 0:49 [merged mm-stable] mm-sparse-vmemmap-support-section-based-vmemmap-accounting.patch removed from -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.