Commit f6bbb78e5bcbe45cfb8ed0d7ecd1549f4eb46a30
Committed by
Linus Torvalds
1 parent
b5e6a5a272
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 11 additions and 0 deletions Side-by-side Diff
mm/memory_hotplug.c
... | ... | @@ -282,6 +282,17 @@ |
282 | 282 | set_page_links(pfn_to_page(pfn), zid, nid, pfn); |
283 | 283 | } |
284 | 284 | |
285 | +/* Can fail with -ENOMEM from allocating a wait table with vmalloc() or | |
286 | + * alloc_bootmem_node_nopanic() */ | |
287 | +static int __ref ensure_zone_is_initialized(struct zone *zone, | |
288 | + unsigned long start_pfn, unsigned long num_pages) | |
289 | +{ | |
290 | + if (!zone_is_initialized(zone)) | |
291 | + return init_currently_empty_zone(zone, start_pfn, num_pages, | |
292 | + MEMMAP_HOTPLUG); | |
293 | + return 0; | |
294 | +} | |
295 | + | |
285 | 296 | static int __meminit move_pfn_range_left(struct zone *z1, struct zone *z2, |
286 | 297 | unsigned long start_pfn, unsigned long end_pfn) |
287 | 298 | { |