X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=mm%2Fsparse.c;h=100040c0dfb6c8e674dada0ed8eb471820e2f75b;hb=31925323b1b51bb65db729e029472a8b1f635b7d;hp=0a51f36ba3a1b9fcaade3481857cbfd4ae1233b2;hpb=0a3a98f6dd4e8f4d928a09302c0d1c56f2192ac3;p=powerpc.git diff --git a/mm/sparse.c b/mm/sparse.c index 0a51f36ba3..100040c0df 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -32,7 +32,10 @@ static struct mem_section *sparse_index_alloc(int nid) unsigned long array_size = SECTIONS_PER_ROOT * sizeof(struct mem_section); - section = alloc_bootmem_node(NODE_DATA(nid), array_size); + if (slab_is_available()) + section = kmalloc_node(array_size, GFP_KERNEL, nid); + else + section = alloc_bootmem_node(NODE_DATA(nid), array_size); if (section) memset(section, 0, array_size); @@ -84,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; @@ -281,9 +281,9 @@ int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, ret = sparse_init_one_section(ms, section_nr, memmap); - if (ret <= 0) - __kfree_section_memmap(memmap, nr_pages); out: pgdat_resize_unlock(pgdat, &flags); + if (ret <= 0) + __kfree_section_memmap(memmap, nr_pages); return ret; }