summaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2008-03-01 13:56:40 -0800
committerChristoph Lameter <clameter@sgi.com>2008-03-03 12:22:32 -0800
commitf619cfe1bda809a97c407f4c723eb3235ecd64e5 (patch)
treed073f8fe0221c2c196aaa888e7bc861c275f7fbd /mm/slub.c
parent7693143481730686362cc6360e3d47c012d9b2c8 (diff)
downloadop-kernel-dev-f619cfe1bda809a97c407f4c723eb3235ecd64e5.zip
op-kernel-dev-f619cfe1bda809a97c407f4c723eb3235ecd64e5.tar.gz
slub: Add kmalloc_large_node() to support kmalloc_node fallback
Slub is missing some NUMA support for large kmallocs. Provide that. Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Christoph Lameter <clameter@sgi.com>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/mm/slub.c b/mm/slub.c
index db8026b..ecacacd 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2592,13 +2592,24 @@ void *__kmalloc(size_t size, gfp_t flags)
}
EXPORT_SYMBOL(__kmalloc);
+static void *kmalloc_large_node(size_t size, gfp_t flags, int node)
+{
+ struct page *page = alloc_pages_node(node, flags | __GFP_COMP,
+ get_order(size));
+
+ 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);
@@ -3146,7 +3157,7 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
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);
OpenPOWER on IntegriCloud