* [PATCH 0/2] mm: memblock: fix debugfs flag reporting @ 2026-08-19 7:54 Meijing Zhao 2026-08-19 7:54 ` [PATCH 1/2] mm: memblock: add missing HugeTLB flag name Meijing Zhao 2026-08-19 7:54 ` [PATCH 2/2] mm: memblock: show all region flags in debugfs Meijing Zhao 0 siblings, 2 replies; 4+ messages in thread From: Meijing Zhao @ 2026-08-19 7:54 UTC (permalink / raw) To: Mike Rapoport, Andrew Morton Cc: linux-mm, linux-kernel, Wandun Chen, Meijing Zhao From: Meijing Zhao <zhaomeijing@lixiang.com> The memblock debugfs interface has two issues when reporting region flags. MEMBLOCK_RSRV_HUGETLB has no corresponding name, and regions with multiple flags only show the lowest set bit. Add the missing HugeTLB flag name and make memblock_debug_show() print all flags. With the series applied, a HugeTLB bootmem reservation is reported as: RSV_KERN|RSV_HUGETLB Meijing Zhao (2): mm: memblock: add missing HugeTLB flag name mm: memblock: show all region flags in debugfs mm/memblock.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] mm: memblock: add missing HugeTLB flag name 2026-08-19 7:54 [PATCH 0/2] mm: memblock: fix debugfs flag reporting Meijing Zhao @ 2026-08-19 7:54 ` Meijing Zhao 2026-08-19 7:54 ` [PATCH 2/2] mm: memblock: show all region flags in debugfs Meijing Zhao 1 sibling, 0 replies; 4+ messages in thread From: Meijing Zhao @ 2026-08-19 7:54 UTC (permalink / raw) To: Mike Rapoport, Andrew Morton Cc: linux-mm, linux-kernel, Wandun Chen, Meijing Zhao From: Meijing Zhao <zhaomeijing@lixiang.com> Commit 7d163a75f821 ("memblock: make HugeTLB bootmem allocation work with KHO") added MEMBLOCK_RSRV_HUGETLB but did not add the corresponding entry to flagname[]. As a result, memblock debugfs cannot report the flag by name. Add the missing RSV_HUGETLB entry. Fixes: 7d163a75f821 ("memblock: make HugeTLB bootmem allocation work with KHO") Signed-off-by: Meijing Zhao <zhaomeijing@lixiang.com> --- mm/memblock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/memblock.c b/mm/memblock.c index 9ce86349a29f..f2952d725c10 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2886,6 +2886,7 @@ static const char * const flagname[] = { [ilog2(MEMBLOCK_RSRV_NOINIT)] = "RSV_NIT", [ilog2(MEMBLOCK_RSRV_KERN)] = "RSV_KERN", [ilog2(MEMBLOCK_KHO_SCRATCH)] = "KHO_SCRATCH", + [ilog2(MEMBLOCK_RSRV_HUGETLB)] = "RSV_HUGETLB", }; static int memblock_debug_show(struct seq_file *m, void *private) -- 2.25.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] mm: memblock: show all region flags in debugfs 2026-08-19 7:54 [PATCH 0/2] mm: memblock: fix debugfs flag reporting Meijing Zhao 2026-08-19 7:54 ` [PATCH 1/2] mm: memblock: add missing HugeTLB flag name Meijing Zhao @ 2026-08-19 7:54 ` Meijing Zhao 2026-08-23 12:14 ` kernel test robot 1 sibling, 1 reply; 4+ messages in thread From: Meijing Zhao @ 2026-08-19 7:54 UTC (permalink / raw) To: Mike Rapoport, Andrew Morton Cc: linux-mm, linux-kernel, Wandun Chen, Meijing Zhao From: Meijing Zhao <zhaomeijing@lixiang.com> Commit 493f349e38d0 ("memblock: Add flags and nid info in memblock debugfs") made memblock_debug_show() stop after finding the first set flag. A memblock region can carry multiple flags, so debugfs hides all but the lowest set bit. In particular, memory allocated for HugeTLB pages is reserved with both MEMBLOCK_RSRV_KERN and MEMBLOCK_RSRV_HUGETLB, but debugfs only reports RSV_KERN. Print every set flag separated by '|'. A HugeTLB reservation is now shown as: RSV_KERN|RSV_HUGETLB instead of: RSV_KERN Fixes: 493f349e38d0 ("memblock: Add flags and nid info in memblock debugfs") Signed-off-by: Meijing Zhao <zhaomeijing@lixiang.com> --- mm/memblock.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index f2952d725c10..5d806fe92cd7 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2896,6 +2896,7 @@ static int memblock_debug_show(struct seq_file *m, void *private) int i, j, nid; unsigned int count = ARRAY_SIZE(flagname); phys_addr_t end; + bool first; for (i = 0; i < type->cnt; i++) { reg = &type->regions[i]; @@ -2909,14 +2910,18 @@ static int memblock_debug_show(struct seq_file *m, void *private) else seq_printf(m, "%4c ", 'x'); if (reg->flags) { + first = true; for (j = 0; j < count; j++) { - if (reg->flags & (1U << j)) { - seq_printf(m, "%s\n", flagname[j]); - break; - } + if (!(reg->flags & (1U << j))) + continue; + if (!first) + seq_putc(m, '|'); + seq_puts(m, flagname[j] ?: "UNKNOWN"); + first = false; } - if (j == count) - seq_printf(m, "%s\n", "UNKNOWN"); + if (first) + seq_puts(m, "UNKNOWN"); + seq_putc(m, '\n'); } else { seq_printf(m, "%s\n", "NONE"); } -- 2.25.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] mm: memblock: show all region flags in debugfs 2026-08-19 7:54 ` [PATCH 2/2] mm: memblock: show all region flags in debugfs Meijing Zhao @ 2026-08-23 12:14 ` kernel test robot 0 siblings, 0 replies; 4+ messages in thread From: kernel test robot @ 2026-08-23 12:14 UTC (permalink / raw) To: Meijing Zhao, Mike Rapoport, Andrew Morton Cc: oe-kbuild-all, Linux Memory Management List, linux-kernel, Wandun Chen, Meijing Zhao Hi Meijing, kernel test robot noticed the following build errors: [auto build test ERROR on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Meijing-Zhao/mm-memblock-add-missing-HugeTLB-flag-name/20260819-155421 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20260819075422.2387980-3-zhaomeijing100%40gmail.com patch subject: [PATCH 2/2] mm: memblock: show all region flags in debugfs config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20260823/202608230255.AL6UNOZq-lkp@intel.com/config) compiler: powerpc64-linux-gcc (GCC) 16.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260823/202608230255.AL6UNOZq-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202608230255.AL6UNOZq-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from include/linux/kernel.h:25, from mm/memblock.c:9: >> mm/memblock.c:2805:16: error: 'MEMBLOCK_RSRV_HUGETLB' undeclared here (not in a function); did you mean 'MEMBLOCK_RSRV_KERN'? 2805 | [ilog2(MEMBLOCK_RSRV_HUGETLB)] = "RSV_HUGETLB", | ^~~~~~~~~~~~~~~~~~~~~ include/linux/log2.h:158:30: note: in definition of macro 'ilog2' 158 | __builtin_constant_p(n) ? \ | ^ >> include/linux/log2.h:157:1: error: array index in initializer not of integer type 157 | ( \ | ^ mm/memblock.c:2805:10: note: in expansion of macro 'ilog2' 2805 | [ilog2(MEMBLOCK_RSRV_HUGETLB)] = "RSV_HUGETLB", | ^~~~~ include/linux/log2.h:157:1: note: (near initialization for 'flagname') mm/memblock.c:2805:10: note: in expansion of macro 'ilog2' 2805 | [ilog2(MEMBLOCK_RSRV_HUGETLB)] = "RSV_HUGETLB", | ^~~~~ vim +2805 mm/memblock.c 2794 2795 #ifdef CONFIG_DEBUG_FS 2796 #ifdef CONFIG_ARCH_KEEP_MEMBLOCK 2797 static const char * const flagname[] = { 2798 [ilog2(MEMBLOCK_HOTPLUG)] = "HOTPLUG", 2799 [ilog2(MEMBLOCK_MIRROR)] = "MIRROR", 2800 [ilog2(MEMBLOCK_NOMAP)] = "NOMAP", 2801 [ilog2(MEMBLOCK_DRIVER_MANAGED)] = "DRV_MNG", 2802 [ilog2(MEMBLOCK_RSRV_NOINIT)] = "RSV_NIT", 2803 [ilog2(MEMBLOCK_RSRV_KERN)] = "RSV_KERN", 2804 [ilog2(MEMBLOCK_KHO_SCRATCH)] = "KHO_SCRATCH", > 2805 [ilog2(MEMBLOCK_RSRV_HUGETLB)] = "RSV_HUGETLB", 2806 }; 2807 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-23 12:14 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-08-19 7:54 [PATCH 0/2] mm: memblock: fix debugfs flag reporting Meijing Zhao 2026-08-19 7:54 ` [PATCH 1/2] mm: memblock: add missing HugeTLB flag name Meijing Zhao 2026-08-19 7:54 ` [PATCH 2/2] mm: memblock: show all region flags in debugfs Meijing Zhao 2026-08-23 12:14 ` kernel test robot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox