X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=mm%2Fsparse.c;h=100040c0dfb6c8e674dada0ed8eb471820e2f75b;hb=46e07f6e5eb0e465e086b8f485f4238bd453e3e9;hp=d7c32de99ee8c49d0e850a06084d5efe508a7625;hpb=2bf9d6d0f2dadc2a6c13684719c67dc043b9ce67;p=karo-tx-linux.git 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) unsigned long array_size = SECTIONS_PER_ROOT * sizeof(struct mem_section); - if (system_state == SYSTEM_RUNNING) + if (slab_is_available()) section = kmalloc_node(array_size, GFP_KERNEL, nid); else section = alloc_bootmem_node(NODE_DATA(nid), array_size); @@ -87,11 +87,8 @@ int __section_nr(struct mem_section* ms) unsigned long root_nr; struct mem_section* root; - for (root_nr = 0; - root_nr < NR_MEM_SECTIONS; - root_nr += SECTIONS_PER_ROOT) { - root = __nr_to_section(root_nr); - + for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) { + root = __nr_to_section(root_nr * SECTIONS_PER_ROOT); if (!root) continue;