diff options
author | Wei Yang <richard.weiyang@gmail.com> | 2024-06-05 07:13:37 +0000 |
---|---|---|
committer | Mike Rapoport (IBM) <rppt@kernel.org> | 2024-06-06 07:55:15 +0300 |
commit | ce8ebb95439459f7e24b02c6943e278f46d2d328 (patch) | |
tree | 5dae9a66be229ae89bcd73adc081ea5818e11232 /mm/mm_init.c | |
parent | 922306a253e20ad5d0c4b8479d2dc5df9f325a04 (diff) |
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>
Diffstat (limited to 'mm/mm_init.c')
-rw-r--r-- | mm/mm_init.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/mm/mm_init.c b/mm/mm_init.c index bdbd800b0436..6eda9367730b 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -2140,7 +2140,7 @@ static int __init deferred_init_memmap(void *data) unsigned long first_init_pfn, flags; unsigned long start = jiffies; struct zone *zone; - int zid, max_threads; + int max_threads; u64 i; /* Bind memory initialisation thread to a local node if possible */ @@ -2167,12 +2167,8 @@ static int __init deferred_init_memmap(void *data) */ pgdat_resize_unlock(pgdat, &flags); - /* Only the highest zone is deferred so find it */ - for (zid = 0; zid < MAX_NR_ZONES; zid++) { - zone = pgdat->node_zones + zid; - if (first_init_pfn < zone_end_pfn(zone)) - break; - } + /* Only the highest zone is deferred */ + zone = pgdat->node_zones + pgdat->nr_zones - 1; /* If the zone is empty somebody else may have cleared out the zone */ if (!deferred_init_mem_pfn_range_in_zone(&i, zone, &spfn, &epfn, @@ -2200,7 +2196,7 @@ static int __init deferred_init_memmap(void *data) } zone_empty: /* Sanity check that the next zone really is unpopulated */ - WARN_ON(++zid < MAX_NR_ZONES && populated_zone(++zone)); + WARN_ON(pgdat->nr_zones < MAX_NR_ZONES && populated_zone(++zone)); pr_info("node %d deferred pages initialised in %ums\n", pgdat->node_id, jiffies_to_msecs(jiffies - start)); |