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

From: David Hildenbrand (Arm)

Date: Tue Mar 17 2026 - 13:01:09 EST


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@xxxxxxxxxx>
---
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