summaryrefslogtreecommitdiffstats
path: root/mm/memory_hotplug.c
diff options
context:
space:
mode:
authorCody P Schafer <cody@linux.vnet.ibm.com>2013-02-22 16:35:30 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 17:50:21 -0800
commitf6bbb78e5bcbe45cfb8ed0d7ecd1549f4eb46a30 (patch)
tree5e98028f9df9eeb0ffe110ce61a98f97d2232d90 /mm/memory_hotplug.c
parentb5e6a5a2724bc9f0b121062ab730d48731ae83e3 (diff)
downloadlinux-f6bbb78e5bcbe45cfb8ed0d7ecd1549f4eb46a30.tar.gz
linux-f6bbb78e5bcbe45cfb8ed0d7ecd1549f4eb46a30.tar.bz2
linux-f6bbb78e5bcbe45cfb8ed0d7ecd1549f4eb46a30.zip
mm: add helper ensure_zone_is_initialized()
ensure_zone_is_initialized() checks if a zone is in a empty & not initialized state (typically occuring after it is created in memory hotplugging), and, if so, calls init_currently_empty_zone() to initialize the zone. Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com> Cc: David Hansen <dave@linux.vnet.ibm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r--mm/memory_hotplug.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 8b3235eedf3d..6e625f60dbcc 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -282,6 +282,17 @@ static void fix_zone_id(struct zone *zone, unsigned long start_pfn,
set_page_links(pfn_to_page(pfn), zid, nid, pfn);
}
+/* Can fail with -ENOMEM from allocating a wait table with vmalloc() or
+ * alloc_bootmem_node_nopanic() */
+static int __ref ensure_zone_is_initialized(struct zone *zone,
+ unsigned long start_pfn, unsigned long num_pages)
+{
+ if (!zone_is_initialized(zone))
+ return init_currently_empty_zone(zone, start_pfn, num_pages,
+ MEMMAP_HOTPLUG);
+ return 0;
+}
+
static int __meminit move_pfn_range_left(struct zone *z1, struct zone *z2,
unsigned long start_pfn, unsigned long end_pfn)
{