Skip to content

Commit ce8ebb9

Browse files
RichardWeiYangrppt
authored andcommitted
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 <[email protected]> Reviewed-by: Mike Rapoport (IBM) <[email protected]> Link: https://lore.kernel.org/all/[email protected] Signed-off-by: Mike Rapoport (IBM) <[email protected]>
1 parent 922306a commit ce8ebb9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

mm/mm_init.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,7 +2140,7 @@ static int __init deferred_init_memmap(void *data)
21402140
unsigned long first_init_pfn, flags;
21412141
unsigned long start = jiffies;
21422142
struct zone *zone;
2143-
int zid, max_threads;
2143+
int max_threads;
21442144
u64 i;
21452145

21462146
/* Bind memory initialisation thread to a local node if possible */
@@ -2167,12 +2167,8 @@ static int __init deferred_init_memmap(void *data)
21672167
*/
21682168
pgdat_resize_unlock(pgdat, &flags);
21692169

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;
21762172

21772173
/* If the zone is empty somebody else may have cleared out the zone */
21782174
if (!deferred_init_mem_pfn_range_in_zone(&i, zone, &spfn, &epfn,
@@ -2200,7 +2196,7 @@ static int __init deferred_init_memmap(void *data)
22002196
}
22012197
zone_empty:
22022198
/* Sanity check that the next zone really is unpopulated */
2203-
WARN_ON(++zid < MAX_NR_ZONES && populated_zone(++zone));
2199+
WARN_ON(pgdat->nr_zones < MAX_NR_ZONES && populated_zone(++zone));
22042200

22052201
pr_info("node %d deferred pages initialised in %ums\n",
22062202
pgdat->node_id, jiffies_to_msecs(jiffies - start));

0 commit comments

Comments
 (0)