Skip to content

Commit

Permalink
mm: initialize hotplugged pages as reserved
Browse files Browse the repository at this point in the history
Commit 92923ca ("mm: meminit: only set page reserved in the
memblock region") broke memory hotplug which expects the memmap for
newly added sections to be reserved until onlined by
online_pages_range().  This patch marks hotplugged pages as reserved
when adding new zones.

Signed-off-by: Mel Gorman <[email protected]>
Reported-by: David Vrabel <[email protected]>
Tested-by: David Vrabel <[email protected]>
Cc: Nathan Zimmer <[email protected]>
Cc: Robin Holt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
gormanm authored and torvalds committed Aug 7, 2015
1 parent 32e5a2a commit e298ff7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn)
int nr_pages = PAGES_PER_SECTION;
int nid = pgdat->node_id;
int zone_type;
unsigned long flags;
unsigned long flags, pfn;
int ret;

zone_type = zone - pgdat->node_zones;
Expand All @@ -461,6 +461,14 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn)
pgdat_resize_unlock(zone->zone_pgdat, &flags);
memmap_init_zone(nr_pages, nid, zone_type,
phys_start_pfn, MEMMAP_HOTPLUG);

/* online_page_range is called later and expects pages reserved */
for (pfn = phys_start_pfn; pfn < phys_start_pfn + nr_pages; pfn++) {
if (!pfn_valid(pfn))
continue;

SetPageReserved(pfn_to_page(pfn));
}
return 0;
}

Expand Down

0 comments on commit e298ff7

Please sign in to comment.