Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/sparse: correct init section annotations
@ 2026-07-31 16:47 Sang-Heon Jeon
  2026-07-31 18:15 ` Andrew Morton
  2026-07-31 19:42 ` David Hildenbrand (Arm)
  0 siblings, 2 replies; 3+ messages in thread
From: Sang-Heon Jeon @ 2026-07-31 16:47 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand
  Cc: Liam R. Howlett, linux-mm, Lorenzo Stoakes, Michal Hocko,
	Mike Rapoport, Suren Baghdasaryan, Vlastimil Babka

The !SPARSEMEM_EXTREME stub of sparse_index_init() has no annotation
but the SPARSEMEM_EXTREME variant is __meminit. So mark the stub
__meminit too.

mminit_validate_memmodel_limits() is only called by memory_present(),
which is __init. So mark it __init.

sparse_usagebuf and sparse_usagebuf_end are only used by
sparse_init_early_section(), sparse_usage_init() and sparse_usage_fini(),
which are all __init. So mark them __initdata.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 mm/sparse.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 704a9dec2b9a..67fa192d4289 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -104,7 +104,7 @@ int __meminit sparse_index_init(unsigned long section_nr, int nid)
 	return 0;
 }
 #else /* !SPARSEMEM_EXTREME */
-int sparse_index_init(unsigned long section_nr, int nid)
+int __meminit sparse_index_init(unsigned long section_nr, int nid)
 {
 	return 0;
 }
@@ -127,7 +127,7 @@ static inline int sparse_early_nid(struct mem_section *section)
 }
 
 /* Validate the physical addressing limitations of the model */
-static void __meminit mminit_validate_memmodel_limits(unsigned long *start_pfn,
+static void __init mminit_validate_memmodel_limits(unsigned long *start_pfn,
 						unsigned long *end_pfn)
 {
 	unsigned long max_sparsemem_pfn = (DIRECT_MAP_PHYSMEM_END + 1) >> PAGE_SHIFT;
@@ -249,8 +249,8 @@ void __weak __meminit vmemmap_populate_print_last(void)
 {
 }
 
-static void *sparse_usagebuf __meminitdata;
-static void *sparse_usagebuf_end __meminitdata;
+static void *sparse_usagebuf __initdata;
+static void *sparse_usagebuf_end __initdata;
 
 /*
  * Helper function that is used for generic section initialization, and
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/sparse: correct init section annotations
  2026-07-31 16:47 [PATCH] mm/sparse: correct init section annotations Sang-Heon Jeon
@ 2026-07-31 18:15 ` Andrew Morton
  2026-07-31 19:42 ` David Hildenbrand (Arm)
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2026-07-31 18:15 UTC (permalink / raw)
  To: Sang-Heon Jeon
  Cc: David Hildenbrand, Liam R. Howlett, linux-mm, Lorenzo Stoakes,
	Michal Hocko, Mike Rapoport, Suren Baghdasaryan, Vlastimil Babka

On Sat,  1 Aug 2026 01:47:55 +0900 Sang-Heon Jeon <ekffu200098@gmail.com> wrote:

> The !SPARSEMEM_EXTREME stub of sparse_index_init() has no annotation
> but the SPARSEMEM_EXTREME variant is __meminit. So mark the stub
> __meminit too.
> 
> mminit_validate_memmodel_limits() is only called by memory_present(),
> which is __init. So mark it __init.
> 
> sparse_usagebuf and sparse_usagebuf_end are only used by
> sparse_init_early_section(), sparse_usage_init() and sparse_usage_fini(),
> which are all __init. So mark them __initdata.
> 

lgtm, thanks.

> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -104,7 +104,7 @@ int __meminit sparse_index_init(unsigned long section_nr, int nid)
>  	return 0;
>  }
>  #else /* !SPARSEMEM_EXTREME */
> -int sparse_index_init(unsigned long section_nr, int nid)
> +int __meminit sparse_index_init(unsigned long section_nr, int nid)
>  {
>  	return 0;
>  }

We could make this

#ifndef CONFIG_SPARSEMEM_EXTREME
static inline int __meminit sparse_index_init(unsigned long section_nr, int nid)
{
	return 0;
}
#endif

in a header and make it go away altogether.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/sparse: correct init section annotations
  2026-07-31 16:47 [PATCH] mm/sparse: correct init section annotations Sang-Heon Jeon
  2026-07-31 18:15 ` Andrew Morton
@ 2026-07-31 19:42 ` David Hildenbrand (Arm)
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand (Arm) @ 2026-07-31 19:42 UTC (permalink / raw)
  To: Sang-Heon Jeon, Andrew Morton
  Cc: Liam R. Howlett, linux-mm, Lorenzo Stoakes, Michal Hocko,
	Mike Rapoport, Suren Baghdasaryan, Vlastimil Babka

On 7/31/26 18:47, Sang-Heon Jeon wrote:
> The !SPARSEMEM_EXTREME stub of sparse_index_init() has no annotation
> but the SPARSEMEM_EXTREME variant is __meminit. So mark the stub
> __meminit too.
> 
> mminit_validate_memmodel_limits() is only called by memory_present(),
> which is __init. So mark it __init.
> 
> sparse_usagebuf and sparse_usagebuf_end are only used by
> sparse_init_early_section(), sparse_usage_init() and sparse_usage_fini(),
> which are all __init. So mark them __initdata.
> 
> Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
> ---

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-31 19:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-31 16:47 [PATCH] mm/sparse: correct init section annotations Sang-Heon Jeon
2026-07-31 18:15 ` Andrew Morton
2026-07-31 19:42 ` David Hildenbrand (Arm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox