Re: [PATCH v2] mm/sparse: keep mem_section_usage_size() internal
From: Mike Rapoport
Date: Wed Aug 05 2026 - 11:02:15 EST
On Wed, Aug 05, 2026 at 10:25:36AM +0800, 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: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> ---
> v2:
> - Mention that ae751d567baa removed the last external user (David)
> - Use struct_size_t() for the mem_section_usage size calculation (David)
> ---
> include/linux/mmzone.h | 1 -
> mm/sparse.c | 10 ----------
> mm/sparse.h | 6 ++++++
> 3 files changed, 6 insertions(+), 11 deletions(-)
--
Sincerely yours,
Mike.