[PATCH v2 RESEND 0/3] mm: memblock: fix debugfs flag reporting and synchronization

Meijing Zhao posted 3 patches 1 month, 1 week ago
mm/memblock.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
[PATCH v2 RESEND 0/3] mm: memblock: fix debugfs flag reporting and synchronization
Posted by Meijing Zhao 1 month, 1 week ago
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.

In addition, memblock_debug_show() walks the region arrays without
synchronizing against memory hotplug. If memory hotplug grows an array,
the debugfs reader may continue accessing the old array after it has
been freed.

Add the missing HugeTLB flag name, report every set bit including those
beyond flagname[], and hold the memory hotplug read lock while walking
the arrays.

With the series applied, a HugeTLB bootmem reservation is reported as:

  RSV_KERN|RSV_HUGETLB

RESEND:
- Regenerate the series from the same clean base as v1. The previous v2
  was inadvertently generated with an unrelated MEMBLOCK_NODUMP change
  in the patch context, causing apply failures. No code changes.

Changes in v2:
- Report set bits beyond flagname[] as UNKNOWN instead of ignoring them.
- Add a separate patch to synchronize debugfs reads with memory hotplug.

v1: https://lore.kernel.org/linux-mm/20260819075422.2387980-1-zhaomeijing100@gmail.com/

Meijing Zhao (3):
  mm: memblock: add missing HugeTLB flag name
  mm: memblock: show all region flags in debugfs
  mm: memblock: synchronize debugfs reads with memory hotplug

 mm/memblock.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

-- 
2.25.1
Re: [PATCH v2 RESEND 0/3] mm: memblock: fix debugfs flag reporting and synchronization
Posted by Mike Rapoport 1 month ago
Hi,

On Fri, Aug 21, 2026 at 10:09:07AM +0800, Meijing Zhao wrote:
> 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.
> 
> In addition, memblock_debug_show() walks the region arrays without
> synchronizing against memory hotplug. If memory hotplug grows an array,
> the debugfs reader may continue accessing the old array after it has
> been freed.
> 
> Add the missing HugeTLB flag name, report every set bit including those
> beyond flagname[], and hold the memory hotplug read lock while walking
> the arrays.
> 
> With the series applied, a HugeTLB bootmem reservation is reported as:
> 
>   RSV_KERN|RSV_HUGETLB
> 
> RESEND:
> - Regenerate the series from the same clean base as v1. The previous v2
>   was inadvertently generated with an unrelated MEMBLOCK_NODUMP change
>   in the patch context, causing apply failures. No code changes.

I presume the changes were on top of linux-next and it's not clear how to
apply them before the end of the merge window.

Can you please resend the patches after v7.3-rc1 is out and base them on
that?
 
> Changes in v2:
> - Report set bits beyond flagname[] as UNKNOWN instead of ignoring them.
> - Add a separate patch to synchronize debugfs reads with memory hotplug.
> 
> v1: https://lore.kernel.org/linux-mm/20260819075422.2387980-1-zhaomeijing100@gmail.com/
> 
> Meijing Zhao (3):
>   mm: memblock: add missing HugeTLB flag name
>   mm: memblock: show all region flags in debugfs
>   mm: memblock: synchronize debugfs reads with memory hotplug
> 
>  mm/memblock.c | 26 ++++++++++++++++++--------
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> -- 
> 2.25.1

-- 
Sincerely yours,
Mike.