aboutsummaryrefslogtreecommitdiffstats
path: root/mm/sparse.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/sparse.c')
-rw-r--r--mm/sparse.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/mm/sparse.c b/mm/sparse.c
index d7c32de99ee8..100040c0dfb6 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -32,7 +32,7 @@ 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 if (system_state == SYSTEM_RUNNING) 35 if (slab_is_available())
36 section = kmalloc_node(array_size, GFP_KERNEL, nid); 36 section = kmalloc_node(array_size, GFP_KERNEL, nid);
37 else 37 else
38 section = alloc_bootmem_node(NODE_DATA(nid), array_size); 38 section = alloc_bootmem_node(NODE_DATA(nid), array_size);
@@ -87,11 +87,8 @@ int __section_nr(struct mem_section* ms)
87 unsigned long root_nr; 87 unsigned long root_nr;
88 struct mem_section* root; 88 struct mem_section* root;
89 89
90 for (root_nr = 0; 90 for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) {
91 root_nr < NR_MEM_SECTIONS; 91 root = __nr_to_section(root_nr * SECTIONS_PER_ROOT);
92 root_nr += SECTIONS_PER_ROOT) {
93 root = __nr_to_section(root_nr);
94
95 if (!root) 92 if (!root)
96 continue; 93 continue;
97 94