]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - mm/sparse.c
[MTD] Add Amstrad Delta NAND support
[linux-2.6-omap-h63xx.git] / mm / sparse.c
index 72079b538e2dac74c136bcebfa47bca7dceb0daa..c5e89eb9ac8ff10e1e15fced114de41058df4a7e 100644 (file)
  */
 #ifdef CONFIG_SPARSEMEM_EXTREME
 struct mem_section *mem_section[NR_SECTION_ROOTS]
-       ____cacheline_maxaligned_in_smp;
+       ____cacheline_internodealigned_in_smp;
 #else
 struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT]
-       ____cacheline_maxaligned_in_smp;
+       ____cacheline_internodealigned_in_smp;
 #endif
 EXPORT_SYMBOL(mem_section);
 
@@ -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);
@@ -281,9 +284,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;
 }