aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/slub_def.h
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux-foundation.org>2009-12-18 17:26:21 -0500
committerPekka Enberg <penberg@cs.helsinki.fi>2009-12-20 02:57:00 -0500
commit756dee75872a2a764b478e18076360b8a4ec9045 (patch)
treec4a09707be2f926631815dec98b0e0f3f4b9ae20 /include/linux/slub_def.h
parent9dfc6e68bfe6ee452efb1a4e9ca26a9007f2b864 (diff)
SLUB: Get rid of dynamic DMA kmalloc cache allocation
Dynamic DMA kmalloc cache allocation is troublesome since the new percpu allocator does not support allocations in atomic contexts. Reserve some statically allocated kmalloc_cpu structures instead. Signed-off-by: Christoph Lameter <cl@linux-foundation.org> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'include/linux/slub_def.h')
-rw-r--r--include/linux/slub_def.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 17ebe0f89bf3..a78fb4ac2015 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -131,11 +131,21 @@ struct kmem_cache {
131 131
132#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2) 132#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2)
133 133
134#ifdef CONFIG_ZONE_DMA
135#define SLUB_DMA __GFP_DMA
136/* Reserve extra caches for potential DMA use */
137#define KMALLOC_CACHES (2 * SLUB_PAGE_SHIFT - 6)
138#else
139/* Disable DMA functionality */
140#define SLUB_DMA (__force gfp_t)0
141#define KMALLOC_CACHES SLUB_PAGE_SHIFT
142#endif
143
134/* 144/*
135 * We keep the general caches in an array of slab caches that are used for 145 * We keep the general caches in an array of slab caches that are used for
136 * 2^x bytes of allocations. 146 * 2^x bytes of allocations.
137 */ 147 */
138extern struct kmem_cache kmalloc_caches[SLUB_PAGE_SHIFT]; 148extern struct kmem_cache kmalloc_caches[KMALLOC_CACHES];
139 149
140/* 150/*
141 * Sorry that the following has to be that ugly but some versions of GCC 151 * Sorry that the following has to be that ugly but some versions of GCC
@@ -203,13 +213,6 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
203 return &kmalloc_caches[index]; 213 return &kmalloc_caches[index];
204} 214}
205 215
206#ifdef CONFIG_ZONE_DMA
207#define SLUB_DMA __GFP_DMA
208#else
209/* Disable DMA functionality */
210#define SLUB_DMA (__force gfp_t)0
211#endif
212
213void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 216void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
214void *__kmalloc(size_t size, gfp_t flags); 217void *__kmalloc(size_t size, gfp_t flags);
215 218