summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMuchun Song <songmuchun@bytedance.com>2026-09-10 14:32:44 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-10-06 17:38:49 -0700
commited3a33cd73da485f9de4ecaeada5b5cf51c073ef (patch)
treedb06f139aeacc7ed7fb07e2ff151f918a43fad0c /include
parent057847a7faa345b775d006d38dc42221ebe35907 (diff)
downloadlinux-next-ed3a33cd73da485f9de4ecaeada5b5cf51c073ef.tar.gz
linux-next-ed3a33cd73da485f9de4ecaeada5b5cf51c073ef.zip
mm/sparse-vmemmap: support section-based vmemmap accounting
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mmzone.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 738bf3d27256..2c4f63e379da 100644
--- a/include/linux/mmzone.h
+++ b/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 \