X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=mm%2Fsparse.c;h=100040c0dfb6c8e674dada0ed8eb471820e2f75b;hb=1def630a6a49dda5bc89dfbd86656293640456f0;hp=0a51f36ba3a1b9fcaade3481857cbfd4ae1233b2;hpb=536ea4e4198eeaa5a73fb734ea675e621609bb7e;p=mirror_ubuntu-artful-kernel.git diff --git a/mm/sparse.c b/mm/sparse.c index 0a51f36ba3a1..100040c0dfb6 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; }