Skip to content

Commit

Permalink
mm/memory_hotplug: use helper function zone_end_pfn() to get end_pfn
Browse files Browse the repository at this point in the history
Commit 108bcc9 ("mm: add & use zone_end_pfn() and zone_spans_pfn()")
introduced the helper zone_end_pfn() to calculate the zone end pfn.  But
update_pgdat_span() forgot to use it.

Use this helper and rename local variable zone_end_pfn to end_pfn to avoid
a naming conflict with the existing zone_end_pfn().

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Miaohe Lin <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
MiaoheLin authored and torvalds committed Feb 26, 2021
1 parent 2601126 commit 6c922cf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,20 +493,19 @@ static void update_pgdat_span(struct pglist_data *pgdat)

for (zone = pgdat->node_zones;
zone < pgdat->node_zones + MAX_NR_ZONES; zone++) {
unsigned long zone_end_pfn = zone->zone_start_pfn +
zone->spanned_pages;
unsigned long end_pfn = zone_end_pfn(zone);

/* No need to lock the zones, they can't change. */
if (!zone->spanned_pages)
continue;
if (!node_end_pfn) {
node_start_pfn = zone->zone_start_pfn;
node_end_pfn = zone_end_pfn;
node_end_pfn = end_pfn;
continue;
}

if (zone_end_pfn > node_end_pfn)
node_end_pfn = zone_end_pfn;
if (end_pfn > node_end_pfn)
node_end_pfn = end_pfn;
if (zone->zone_start_pfn < node_start_pfn)
node_start_pfn = zone->zone_start_pfn;
}
Expand Down

0 comments on commit 6c922cf

Please sign in to comment.