aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/slub_def.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-20 06:15:30 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-20 06:15:30 -0500
commit057685cf57066bc8aaed68de1b1970e12f0075d2 (patch)
treee7fea68e7080d6366b45775028bfbdf6237ecda5 /include/linux/slub_def.h
parent64b36ca7f408e0bd45487c8c28f168f11f3b6dcd (diff)
parentfe1200b63d158b28eef6d4de1e5b5f99c681ba2f (diff)
Merge branch 'for-ingo' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6 into tracing/kmemtrace
Conflicts: mm/slub.c
Diffstat (limited to 'include/linux/slub_def.h')
-rw-r--r--include/linux/slub_def.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 6b657f7dcb2b..9e3a575b2c30 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -122,10 +122,23 @@ struct kmem_cache {
122#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) 122#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
123 123
124/* 124/*
125 * Maximum kmalloc object size handled by SLUB. Larger object allocations
126 * are passed through to the page allocator. The page allocator "fastpath"
127 * is relatively slow so we need this value sufficiently high so that
128 * performance critical objects are allocated through the SLUB fastpath.
129 *
130 * This should be dropped to PAGE_SIZE / 2 once the page allocator
131 * "fastpath" becomes competitive with the slab allocator fastpaths.
132 */
133#define SLUB_MAX_SIZE (PAGE_SIZE)
134
135#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 1)
136
137/*
125 * We keep the general caches in an array of slab caches that are used for 138 * We keep the general caches in an array of slab caches that are used for
126 * 2^x bytes of allocations. 139 * 2^x bytes of allocations.
127 */ 140 */
128extern struct kmem_cache kmalloc_caches[PAGE_SHIFT + 1]; 141extern struct kmem_cache kmalloc_caches[SLUB_PAGE_SHIFT];
129 142
130/* 143/*
131 * Sorry that the following has to be that ugly but some versions of GCC 144 * Sorry that the following has to be that ugly but some versions of GCC
@@ -231,7 +244,7 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
231 void *ret; 244 void *ret;
232 245
233 if (__builtin_constant_p(size)) { 246 if (__builtin_constant_p(size)) {
234 if (size > PAGE_SIZE) 247 if (size > SLUB_MAX_SIZE)
235 return kmalloc_large(size, flags); 248 return kmalloc_large(size, flags);
236 249
237 if (!(flags & SLUB_DMA)) { 250 if (!(flags & SLUB_DMA)) {
@@ -275,7 +288,7 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
275 void *ret; 288 void *ret;
276 289
277 if (__builtin_constant_p(size) && 290 if (__builtin_constant_p(size) &&
278 size <= PAGE_SIZE && !(flags & SLUB_DMA)) { 291 size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) {
279 struct kmem_cache *s = kmalloc_slab(size); 292 struct kmem_cache *s = kmalloc_slab(size);
280 293
281 if (!s) 294 if (!s)