Re: [PATCH v2] mm/sparse: keep mem_section_usage_size() internal

From: David Hildenbrand (Arm)

Date: Wed Aug 05 2026 - 11:05:07 EST


On 8/5/26 04:25, Muchun Song wrote:
> mem_section_usage_size() is only needed by sparsemem implementation code
> after commit ae751d567baa ("mm/bootmem_info: stop marking mem_section_usage
> as MIX_SECTION_INFO"), so keeping the declaration in mmzone.h now exposes
> the helper to all mmzone.h users for no reason.
>
> Move the helper to sparse.h so sparse.c and sparse-vmemmap.c can share it
> through the internal header. While doing so, calculate the allocation size
> with struct_size_t(), which ties the expression to the pageblock_flags
> trailing array instead of open-coding the struct header plus bitmap size.
>
> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
> ---

Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David