aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/sparse.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/mm/sparse.c b/mm/sparse.c
index 0a51f36ba3a1..d7c32de99ee8 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -32,7 +32,10 @@ static struct mem_section *sparse_index_alloc(int nid)
32 unsigned long array_size = SECTIONS_PER_ROOT * 32 unsigned long array_size = SECTIONS_PER_ROOT *
33 sizeof(struct mem_section); 33 sizeof(struct mem_section);
34 34
35 section = alloc_bootmem_node(NODE_DATA(nid), array_size); 35 if (system_state == SYSTEM_RUNNING)
36 section = kmalloc_node(array_size, GFP_KERNEL, nid);
37 else
38 section = alloc_bootmem_node(NODE_DATA(nid), array_size);
36 39
37 if (section) 40 if (section)
38 memset(section, 0, array_size); 41 memset(section, 0, array_size);
@@ -281,9 +284,9 @@ int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
281 284
282 ret = sparse_init_one_section(ms, section_nr, memmap); 285 ret = sparse_init_one_section(ms, section_nr, memmap);
283 286
284 if (ret <= 0)
285 __kfree_section_memmap(memmap, nr_pages);
286out: 287out:
287 pgdat_resize_unlock(pgdat, &flags); 288 pgdat_resize_unlock(pgdat, &flags);
289 if (ret <= 0)
290 __kfree_section_memmap(memmap, nr_pages);
288 return ret; 291 return ret;
289} 292}