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

Mike Rapoport <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.kernel.mm
Message-ID <[email protected]>
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 <[email protected]>

Acked-by: Mike Rapoport (Microsoft) <[email protected]>

> ---
> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.