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

David Hildenbrand (Arm) posted 14 patches 2 weeks, 6 days ago
There is a newer version of this series
[PATCH 13/14] mm/sparse: move __section_mark_present() to internal.h
Posted by David Hildenbrand (Arm) 2 weeks, 6 days ago
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>
---
 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
Re: [PATCH 13/14] mm/sparse: move __section_mark_present() to internal.h
Posted by Mike Rapoport 2 weeks, 5 days ago
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.

Not strictly related to this patchset, we might want to start splitting
internal.h to sub-headers.
 
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>

Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

> ---
>  mm/internal.h | 9 +++++++++
>  mm/sparse.c   | 8 --------
>  2 files changed, 9 insertions(+), 8 deletions(-)

-- 
Sincerely yours,
Mike.
Re: [PATCH 13/14] mm/sparse: move __section_mark_present() to internal.h
Posted by David Hildenbrand (Arm) 2 weeks, 3 days ago
On 3/18/26 09:56, Mike Rapoport wrote:
> 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.
> 
> Not strictly related to this patchset, we might want to start splitting
> internal.h to sub-headers.

Yes, that makes sense. And we should also split the non-internal headers
in a smarter way (and do some serious cleanups, it's a mess).

-- 
Cheers,

David
Re: [PATCH 13/14] mm/sparse: move __section_mark_present() to internal.h
Posted by Lorenzo Stoakes (Oracle) 2 weeks, 6 days ago
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
>