From f942617011dbfc708cc7e39b1337658d540d565b Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 26 Sep 2007 10:46:42 -0700 Subject: [PATCH] vcompound_sparse_gfp_vfallback Use GFP_VFALLBACK for sparsemem. Sparsemem currently attempts first to do a physically contiguous mapping and then falls back to vmalloc. The same thing can now be accomplished using GFP_VFALLBACK. Signed-off-by: Christoph Lameter --- mm/sparse.c | 23 +++-------------------- 1 files changed, 3 insertions(+), 20 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index e4c69e2..31a9b53 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -269,32 +269,15 @@ void __init sparse_init(void) #ifdef CONFIG_MEMORY_HOTPLUG static struct page *__kmalloc_section_memmap(unsigned long nr_pages) { - struct page *page, *ret; unsigned long memmap_size = sizeof(struct page) * nr_pages; - page = alloc_pages(GFP_KERNEL|__GFP_NOWARN, get_order(memmap_size)); - if (page) - goto got_map_page; - - ret = vmalloc(memmap_size); - if (ret) - goto got_map_ptr; - - return NULL; -got_map_page: - ret = (struct page *)pfn_to_kaddr(page_to_pfn(page)); -got_map_ptr: - memset(ret, 0, memmap_size); - - return ret; + return (struct page *)__get_free_pages(GFP_VFALLBACK, + get_order(memmap_size)); } static void __kfree_section_memmap(struct page *memmap, unsigned long nr_pages) { - if (is_vmalloc_addr(memmap)) - vfree(memmap); - else - free_pages((unsigned long)memmap, + free_pages((unsigned long)memmap, get_order(sizeof(struct page) * nr_pages)); } -- 1.5.4.1