X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=mm%2Fsparse.c;h=0a51f36ba3a1b9fcaade3481857cbfd4ae1233b2;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=100040c0dfb6c8e674dada0ed8eb471820e2f75b;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/mm/sparse.c b/mm/sparse.c index 100040c0d..0a51f36ba 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -32,10 +32,7 @@ static struct mem_section *sparse_index_alloc(int nid) unsigned long array_size = SECTIONS_PER_ROOT * sizeof(struct mem_section); - if (slab_is_available()) - section = kmalloc_node(array_size, GFP_KERNEL, nid); - else - section = alloc_bootmem_node(NODE_DATA(nid), array_size); + section = alloc_bootmem_node(NODE_DATA(nid), array_size); if (section) memset(section, 0, array_size); @@ -87,8 +84,11 @@ int __section_nr(struct mem_section* ms) unsigned long root_nr; struct mem_section* root; - for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) { - root = __nr_to_section(root_nr * SECTIONS_PER_ROOT); + for (root_nr = 0; + root_nr < NR_MEM_SECTIONS; + root_nr += SECTIONS_PER_ROOT) { + root = __nr_to_section(root_nr); + 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); -out: - pgdat_resize_unlock(pgdat, &flags); if (ret <= 0) __kfree_section_memmap(memmap, nr_pages); +out: + pgdat_resize_unlock(pgdat, &flags); return ret; }