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: get the highest zone directly

We have recorded nr_zones in pgdat, just get it directly.

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)
ce8ebb95 922306a2

+4 -8
+4 -8
mm/mm_init.c
··· 2140 2140 unsigned long first_init_pfn, flags; 2141 2141 unsigned long start = jiffies; 2142 2142 struct zone *zone; 2143 - int zid, max_threads; 2143 + int max_threads; 2144 2144 u64 i; 2145 2145 2146 2146 /* Bind memory initialisation thread to a local node if possible */ ··· 2167 2167 */ 2168 2168 pgdat_resize_unlock(pgdat, &flags); 2169 2169 2170 - /* Only the highest zone is deferred so find it */ 2171 - for (zid = 0; zid < MAX_NR_ZONES; zid++) { 2172 - zone = pgdat->node_zones + zid; 2173 - if (first_init_pfn < zone_end_pfn(zone)) 2174 - break; 2175 - } 2170 + /* Only the highest zone is deferred */ 2171 + zone = pgdat->node_zones + pgdat->nr_zones - 1; 2176 2172 2177 2173 /* If the zone is empty somebody else may have cleared out the zone */ 2178 2174 if (!deferred_init_mem_pfn_range_in_zone(&i, zone, &spfn, &epfn, ··· 2196 2200 } 2197 2201 zone_empty: 2198 2202 /* Sanity check that the next zone really is unpopulated */ 2199 - WARN_ON(++zid < MAX_NR_ZONES && populated_zone(++zone)); 2203 + WARN_ON(pgdat->nr_zones < MAX_NR_ZONES && populated_zone(++zone)); 2200 2204 2201 2205 pr_info("node %d deferred pages initialised in %ums\n", 2202 2206 pgdat->node_id, jiffies_to_msecs(jiffies - start));