Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: prepare to move subsection_map_init() to mm/sparse-vmemmap.c

We want to move subsection_map_init() to mm/sparse-vmemmap.c.

To prepare for getting rid of subsection_map_init() in mm/sparse.c
completely, use a static inline function for !CONFIG_SPARSEMEM_VMEMMAP.

While at it, move the declaration to internal.h and rename it to
"sparse_init_subsection_map()".

Link: https://lkml.kernel.org/r/20260320-sparsemem_cleanups-v2-11-096addc8800d@kernel.org
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand (Arm) and committed by
Andrew Morton
fead6dcf dac89b15

+14 -9
-3
include/linux/mmzone.h
··· 1982 1982 unsigned long pageblock_flags[0]; 1983 1983 }; 1984 1984 1985 - void subsection_map_init(unsigned long pfn, unsigned long nr_pages); 1986 - 1987 1985 struct page; 1988 1986 struct page_ext; 1989 1987 struct mem_section { ··· 2374 2376 #define sparse_vmemmap_init_nid_early(_nid) do {} while (0) 2375 2377 #define sparse_vmemmap_init_nid_late(_nid) do {} while (0) 2376 2378 #define pfn_in_present_section pfn_valid 2377 - #define subsection_map_init(_pfn, _nr_pages) do {} while (0) 2378 2379 #endif /* CONFIG_SPARSEMEM */ 2379 2380 2380 2381 /*
+12
mm/internal.h
··· 959 959 unsigned long, enum meminit_context, struct vmem_altmap *, int, 960 960 bool); 961 961 962 + /* 963 + * mm/sparse.c 964 + */ 962 965 #ifdef CONFIG_SPARSEMEM 963 966 void sparse_init(void); 964 967 #else 965 968 static inline void sparse_init(void) {} 966 969 #endif /* CONFIG_SPARSEMEM */ 970 + 971 + #ifdef CONFIG_SPARSEMEM_VMEMMAP 972 + void sparse_init_subsection_map(unsigned long pfn, unsigned long nr_pages); 973 + #else 974 + static inline void sparse_init_subsection_map(unsigned long pfn, 975 + unsigned long nr_pages) 976 + { 977 + } 978 + #endif /* CONFIG_SPARSEMEM_VMEMMAP */ 967 979 968 980 #if defined CONFIG_COMPACTION || defined CONFIG_CMA 969 981
+1 -1
mm/mm_init.c
··· 1896 1896 pr_info(" node %3d: [mem %#018Lx-%#018Lx]\n", nid, 1897 1897 (u64)start_pfn << PAGE_SHIFT, 1898 1898 ((u64)end_pfn << PAGE_SHIFT) - 1); 1899 - subsection_map_init(start_pfn, end_pfn - start_pfn); 1899 + sparse_init_subsection_map(start_pfn, end_pfn - start_pfn); 1900 1900 } 1901 1901 1902 1902 /* Initialise every node */
+1 -5
mm/sparse.c
··· 185 185 bitmap_set(map, idx, end - idx + 1); 186 186 } 187 187 188 - void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages) 188 + void __init sparse_init_subsection_map(unsigned long pfn, unsigned long nr_pages) 189 189 { 190 190 int end_sec_nr = pfn_to_section_nr(pfn + nr_pages - 1); 191 191 unsigned long nr, start_sec_nr = pfn_to_section_nr(pfn); ··· 206 206 pfn += pfns; 207 207 nr_pages -= pfns; 208 208 } 209 - } 210 - #else 211 - void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages) 212 - { 213 209 } 214 210 #endif 215 211