Re: [PATCH 08/17] mm/sparse: mark memory sections present earlier

From: Muchun Song

Date: Thu Jul 09 2026 - 08:37:13 EST




> On Jul 9, 2026, at 18:54, Mike Rapoport <rppt@xxxxxxxxxx> wrote:
>
> On Thu, Jul 02, 2026 at 05:38:12PM +0800, Muchun Song wrote:
>> Upcoming HugeTLB bootmem changes need sparsemem section metadata before
>> the HugeTLB bootmem allocation path runs. The memblock ranges are marked
>> present from sparse_init(), which is called too late for that setup.
>
> It's not only that memblock regions are marked present, but it actually
> initializes mem_section's for the present memory ...

Right.

>
>> Move the code that marks memblock ranges present into
>> mm_core_init_early(), before free_area_init() and the HugeTLB bootmem
>> setup. Rename the helper to sparse_memblock_present() to make the new
>
> ... so let's name this function to reflect that.
>
> How about sparse_sections_init()?

Make sense. This name really captures the function's purpose well.
I'll go ahead and use it.

Muchun,
Thanks.

>
>> caller describe the sparsemem-specific initialization step.
>>
>> This is a preparatory change.
>>
>> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
>> ---
>> mm/internal.h | 2 ++
>> mm/mm_init.c | 1 +
>> mm/sparse.c | 4 +---
>> 3 files changed, 4 insertions(+), 3 deletions(-)
>
> --
> Sincerely yours,
> Mike.