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/mm_init.c: use deferred_init_mem_pfn_range_in_zone() to decide loop condition

If deferred_init_mem_pfn_range_in_zone() return true, we know it finds
some range in (spfn, epfn). Then we can use it directly for the loop
condition.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Link: https://lore.kernel.org/all/20240605071339.15330-1-richard.weiyang@gmail.com
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>

authored by

Wei Yang and committed by
Mike Rapoport (IBM)
544b8e14 ce8ebb95

+4 -11
+4 -11
mm/mm_init.c
··· 2170 2170 /* Only the highest zone is deferred */ 2171 2171 zone = pgdat->node_zones + pgdat->nr_zones - 1; 2172 2172 2173 - /* If the zone is empty somebody else may have cleared out the zone */ 2174 - if (!deferred_init_mem_pfn_range_in_zone(&i, zone, &spfn, &epfn, 2175 - first_init_pfn)) 2176 - goto zone_empty; 2177 - 2178 2173 max_threads = deferred_page_init_max_threads(cpumask); 2179 2174 2180 - while (spfn < epfn) { 2181 - unsigned long epfn_align = ALIGN(epfn, PAGES_PER_SECTION); 2175 + while (deferred_init_mem_pfn_range_in_zone(&i, zone, &spfn, &epfn, first_init_pfn)) { 2176 + first_init_pfn = ALIGN(epfn, PAGES_PER_SECTION); 2182 2177 struct padata_mt_job job = { 2183 2178 .thread_fn = deferred_init_memmap_chunk, 2184 2179 .fn_arg = zone, 2185 2180 .start = spfn, 2186 - .size = epfn_align - spfn, 2181 + .size = first_init_pfn - spfn, 2187 2182 .align = PAGES_PER_SECTION, 2188 2183 .min_chunk = PAGES_PER_SECTION, 2189 2184 .max_threads = max_threads, ··· 2186 2191 }; 2187 2192 2188 2193 padata_do_multithreaded(&job); 2189 - deferred_init_mem_pfn_range_in_zone(&i, zone, &spfn, &epfn, 2190 - epfn_align); 2191 2194 } 2192 - zone_empty: 2195 + 2193 2196 /* Sanity check that the next zone really is unpopulated */ 2194 2197 WARN_ON(pgdat->nr_zones < MAX_NR_ZONES && populated_zone(++zone)); 2195 2198