Re: [PATCH 13/14] mm/sparse: move __section_mark_present() to internal.h

Lorenzo Stoakes (Oracle)
2026-03-17T20:01:55Z

On Tue, Mar 17, 2026 at 05:56:51PM +0100, David Hildenbrand (Arm) wrote:
> Let's prepare for moving memory hotplug handling from sparse.c to
> sparse-vmemmap.c by moving __section_mark_present() to internal.h.
>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>

Let's prepare for me finishing reviewing the series with:

Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>

> ---
> mm/internal.h | 9 +++++++++
> mm/sparse.c | 8 --------
> 2 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/mm/internal.h b/mm/internal.h
> index bcf4df97b185..835a6f00134e 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -987,6 +987,15 @@ static inline void sparse_init_one_section(struct mem_section *ms,
> ms->section_mem_map |= SECTION_HAS_MEM_MAP | flags;
> ms->usage = usage;
> }
> +
> +static inline void __section_mark_present(struct mem_section *ms,
> + unsigned long section_nr)
> +{
> + if (section_nr > __highest_present_section_nr)
> + __highest_present_section_nr = section_nr;
> +
> + ms->section_mem_map |= SECTION_MARKED_PRESENT;
> +}
> #else
> static inline void sparse_init(void) {}
> #endif /* CONFIG_SPARSEMEM */
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 6f5f340301a3..bf620f3fe05d 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -161,14 +161,6 @@ static void __meminit mminit_validate_memmodel_limits(unsigned long *start_pfn,
> * those loops early.
> */
> unsigned long __highest_present_section_nr;
> -static void __section_mark_present(struct mem_section *ms,
> - unsigned long section_nr)
> -{
> - if (section_nr > __highest_present_section_nr)
> - __highest_present_section_nr = section_nr;
> -
> - ms->section_mem_map |= SECTION_MARKED_PRESENT;
> -}
>
> static inline unsigned long first_present_section_nr(void)
> {
> --
> 2.43.0
>