Re: [PATCH 04/12] mm/sparse: rename and cleanup sparse_init_nid()
From: "David Hildenbrand (Arm)" <david@kernel.org>
Date: 2026-09-10 14:29:39
Also in:
driver-core, linux-cxl, linux-fsdevel, lkml
On 9/10/26 15:46, Lorenzo Stoakes (ARM) wrote:
On Wed, Sep 09, 2026 at 03:32:57PM +0200, David Hildenbrand (Arm) wrote:quoted
Let's rename it to "sparse_metadata_init_nid", avoid the "pnum" terminology and drop the function comment. Further, rename the "map" variable to "mem_map" for consistency with other functions. Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>LGTM, one nit below. Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>quoted
--- mm/sparse.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-)diff --git a/mm/sparse.c b/mm/sparse.c index a85a9c3840f6c..f84bfceb53060 100644 --- a/mm/sparse.c +++ b/mm/sparse.c@@ -222,37 +222,34 @@ void __weak __meminit vmemmap_populate_print_last(void) { } -/* - * Initialize sparse on a specific node. The node spans [pnum_begin, pnum_end) - * And number of present sections in this node is map_count. - */ -static void __init sparse_init_nid(int nid, unsigned long pnum_begin, - unsigned long pnum_end, - unsigned long map_count) +static void __init sparse_metadata_init_nid(int nid, + unsigned long start_section_nr, unsigned long end_section_nr, + unsigned long nr_sections) { - unsigned long pnum; struct mem_section_usage *usage; + unsigned long section_nr; - usage = memblock_alloc_node(map_count * mem_section_usage_size(), + usage = memblock_alloc_node(nr_sections * mem_section_usage_size(), SMP_CACHE_BYTES, nid); if (!usage) panic("Failed to allocate usemap for node %d\n", nid); - for_each_present_section_nr(pnum_begin, pnum) { - unsigned long pfn = section_nr_to_pfn(pnum); - struct page *map; + for_each_present_section_nr(start_section_nr, section_nr) { + unsigned long pfn = section_nr_to_pfn(section_nr);NIT: Could be const?
ack! -- Cheers, David