linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: initialize hotplugged pages as reserved
@ 2015-08-03  8:19 Mel Gorman
  0 siblings, 0 replies; only message in thread
From: Mel Gorman @ 2015-08-03  8:19 UTC (permalink / raw)
  To: Andrew Morton; +Cc: David Vrabel, Alex Ng, linux-kernel, linux-mm

Commit 92923ca3aace (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 <mgorman@suse.de>
Reported-and-tested-by: David Vrabel <david.vrabel@citrix.com>
---
 mm/memory_hotplug.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 460d0fe..169770a 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -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;
@@ -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;
 }
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-03  8:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-03  8:19 [PATCH] mm: initialize hotplugged pages as reserved Mel Gorman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).