[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1358295894-24167-5-git-send-email-cody@linux.vnet.ibm.com>
Date: Tue, 15 Jan 2013 16:24:41 -0800
From: Cody P Schafer <cody@...ux.vnet.ibm.com>
To: Linux MM <linux-mm@...ck.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Catalin Marinas <catalin.marinas@....com>,
Cody P Schafer <jmesmon@...il.com>,
Cody P Schafer <cody@...ux.vnet.ibm.com>
Subject: [PATCH 04/17] mm: add helper ensure_zone_is_initialized()
From: Cody P Schafer <jmesmon@...il.com>
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@...ux.vnet.ibm.com>
---
mm/memory_hotplug.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index d04ed87..875bdfe 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -253,6 +253,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)
{
--
1.8.0.3
--
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