[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20150803081922.GG5840@techsingularity.net>
Date: Mon, 3 Aug 2015 09:19:22 +0100
From: Mel Gorman <mgorman@...hsingularity.net>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: David Vrabel <david.vrabel@...rix.com>,
Alex Ng <alexng@...rosoft.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: [PATCH] mm: initialize hotplugged pages as reserved
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@...e.de>
Reported-and-tested-by: David Vrabel <david.vrabel@...rix.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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists