From: Christoph Lameter Subject: slub: Add kmalloc_large_node() to support kmalloc_node fallback Signed-off-by: Christoph Lameter --- mm/slub.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) Index: linux-2.6/mm/slub.c =================================================================== --- linux-2.6.orig/mm/slub.c 2008-02-15 23:15:22.000000000 -0800 +++ linux-2.6/mm/slub.c 2008-02-15 23:15:29.000000000 -0800 @@ -2683,13 +2683,24 @@ void *__kmalloc(size_t size, gfp_t flags } EXPORT_SYMBOL(__kmalloc); +void *kmalloc_large_node(size_t size, gfp_t flags, int node) +{ + struct page *page = alloc_pages_node(flags | __GFP_COMP, + get_order(size), node); + + if (page) + return page_address(page); + else + return NULL; +} + #ifdef CONFIG_NUMA void *__kmalloc_node(size_t size, gfp_t flags, int node) { struct kmem_cache *s; if (unlikely(size > PAGE_SIZE)) - return kmalloc_large(size, flags); + return kmalloc_large_node(size, flags, node); s = get_slab(size, flags); @@ -3251,7 +3262,7 @@ void *__kmalloc_node_track_caller(size_t struct kmem_cache *s; if (unlikely(size > PAGE_SIZE)) - return kmalloc_large(size, gfpflags); + return kmalloc_large_node(size, gfpflags, node); s = get_slab(size, gfpflags);