aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-26 19:18:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-26 19:18:17 -0400
commitbe0ea69674ed95e1e98cb3687a241badc756d228 (patch)
tree36d0db8fe389d65bbc8c7aa5be0e61b066f9536a /include
parent4496d937a518fde0d0e1980e4ab470cedb4b50cd (diff)
parent15a5b0a4912d98a9615ef457c7bde8d08195a771 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6: slob: fix lockup in slob_free() slub: use get_track() slub: rename calculate_min_partial() to set_min_partial() slub: add min_partial sysfs tunable slub: move min_partial to struct kmem_cache SLUB: Fix default slab order for big object sizes SLUB: Do not pass 8k objects through to the page allocator SLUB: Introduce and use SLUB_MAX_SIZE and SLUB_PAGE_SHIFT constants slob: clean up the code SLUB: Use ->objsize from struct kmem_cache_cpu in slab_free()
Diffstat (limited to 'include')
-rw-r--r--include/linux/slub_def.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 2f5c16b1aacd..e37b6aa8a9fb 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -46,7 +46,6 @@ struct kmem_cache_cpu {
46struct kmem_cache_node { 46struct kmem_cache_node {
47 spinlock_t list_lock; /* Protect partial list and nr_partial */ 47 spinlock_t list_lock; /* Protect partial list and nr_partial */
48 unsigned long nr_partial; 48 unsigned long nr_partial;
49 unsigned long min_partial;
50 struct list_head partial; 49 struct list_head partial;
51#ifdef CONFIG_SLUB_DEBUG 50#ifdef CONFIG_SLUB_DEBUG
52 atomic_long_t nr_slabs; 51 atomic_long_t nr_slabs;
@@ -89,6 +88,7 @@ struct kmem_cache {
89 void (*ctor)(void *); 88 void (*ctor)(void *);
90 int inuse; /* Offset to metadata */ 89 int inuse; /* Offset to metadata */
91 int align; /* Alignment */ 90 int align; /* Alignment */
91 unsigned long min_partial;
92 const char *name; /* Name (only for display!) */ 92 const char *name; /* Name (only for display!) */
93 struct list_head list; /* List of slab caches */ 93 struct list_head list; /* List of slab caches */
94#ifdef CONFIG_SLUB_DEBUG 94#ifdef CONFIG_SLUB_DEBUG
@@ -121,10 +121,23 @@ struct kmem_cache {
121#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) 121#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
122 122
123/* 123/*
124 * Maximum kmalloc object size handled by SLUB. Larger object allocations
125 * are passed through to the page allocator. The page allocator "fastpath"
126 * is relatively slow so we need this value sufficiently high so that
127 * performance critical objects are allocated through the SLUB fastpath.
128 *
129 * This should be dropped to PAGE_SIZE / 2 once the page allocator
130 * "fastpath" becomes competitive with the slab allocator fastpaths.
131 */
132#define SLUB_MAX_SIZE (2 * PAGE_SIZE)
133
134#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2)
135
136/*
124 * We keep the general caches in an array of slab caches that are used for 137 * We keep the general caches in an array of slab caches that are used for
125 * 2^x bytes of allocations. 138 * 2^x bytes of allocations.
126 */ 139 */
127extern struct kmem_cache kmalloc_caches[PAGE_SHIFT + 1]; 140extern struct kmem_cache kmalloc_caches[SLUB_PAGE_SHIFT];
128 141
129/* 142/*
130 * Sorry that the following has to be that ugly but some versions of GCC 143 * Sorry that the following has to be that ugly but some versions of GCC
@@ -212,7 +225,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
212static __always_inline void *kmalloc(size_t size, gfp_t flags) 225static __always_inline void *kmalloc(size_t size, gfp_t flags)
213{ 226{
214 if (__builtin_constant_p(size)) { 227 if (__builtin_constant_p(size)) {
215 if (size > PAGE_SIZE) 228 if (size > SLUB_MAX_SIZE)
216 return kmalloc_large(size, flags); 229 return kmalloc_large(size, flags);
217 230
218 if (!(flags & SLUB_DMA)) { 231 if (!(flags & SLUB_DMA)) {
@@ -234,7 +247,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
234static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) 247static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
235{ 248{
236 if (__builtin_constant_p(size) && 249 if (__builtin_constant_p(size) &&
237 size <= PAGE_SIZE && !(flags & SLUB_DMA)) { 250 size <= SLUB_MAX_SIZE && !(flags & SLUB_DMA)) {
238 struct kmem_cache *s = kmalloc_slab(size); 251 struct kmem_cache *s = kmalloc_slab(size);
239 252
240 if (!s) 253 if (!s)