linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / mm / sparse.c
index 100040c..0a51f36 100644 (file)
@@ -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;
 }