aboutsummaryrefslogtreecommitdiffstats
path: root/mm/sparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/sparse.c')
-rw-r--r--mm/sparse.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/mm/sparse.c b/mm/sparse.c
index 0a51f36ba3a1..100040c0dfb6 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 (slab_is_available())
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);
@@ -84,11 +87,8 @@ int __section_nr(struct mem_section* ms)
84 unsigned long root_nr; 87 unsigned long root_nr;
85 struct mem_section* root; 88 struct mem_section* root;
86 89
87 for (root_nr = 0; 90 for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) {
88 root_nr < NR_MEM_SECTIONS; 91 root = __nr_to_section(root_nr * SECTIONS_PER_ROOT);
89 root_nr += SECTIONS_PER_ROOT) {
90 root = __nr_to_section(root_nr);
91
92 if (!root) 92 if (!root)
93 continue; 93 continue;
94 94
@@ -281,9 +281,9 @@ int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
281 281
282 ret = sparse_init_one_section(ms, section_nr, memmap); 282 ret = sparse_init_one_section(ms, section_nr, memmap);
283 283
284 if (ret <= 0)
285 __kfree_section_memmap(memmap, nr_pages);
286out: 284out:
287 pgdat_resize_unlock(pgdat, &flags); 285 pgdat_resize_unlock(pgdat, &flags);
286 if (ret <= 0)
287 __kfree_section_memmap(memmap, nr_pages);
288 return ret; 288 return ret;
289} 289}