aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2008-02-11 15:47:46 -0500
committerChristoph Lameter <christoph@stapp.engr.sgi.com>2008-02-14 18:30:01 -0500
commiteada35efcb2773cf49aa26277e056122e1a3405c (patch)
tree69803b03b6f6106722d4cc293678f2e3183bec2e /include
parente51bfd0ad10600a9fe4c8ede5ac2272e80075008 (diff)
slub: kmalloc page allocator pass-through cleanup
This adds a proper function for kmalloc page allocator pass-through. While it simplifies any code that does slab tracing code a lot, I think it's a worthwhile cleanup in itself. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Christoph Lameter <clameter@sgi.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/slub_def.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 5e6d3d634d5b..a849c472b845 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -188,12 +188,16 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
188void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 188void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
189void *__kmalloc(size_t size, gfp_t flags); 189void *__kmalloc(size_t size, gfp_t flags);
190 190
191static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
192{
193 return (void *)__get_free_pages(flags | __GFP_COMP, get_order(size));
194}
195
191static __always_inline void *kmalloc(size_t size, gfp_t flags) 196static __always_inline void *kmalloc(size_t size, gfp_t flags)
192{ 197{
193 if (__builtin_constant_p(size)) { 198 if (__builtin_constant_p(size)) {
194 if (size > PAGE_SIZE / 2) 199 if (size > PAGE_SIZE / 2)
195 return (void *)__get_free_pages(flags | __GFP_COMP, 200 return kmalloc_large(size, flags);
196 get_order(size));
197 201
198 if (!(flags & SLUB_DMA)) { 202 if (!(flags & SLUB_DMA)) {
199 struct kmem_cache *s = kmalloc_slab(size); 203 struct kmem_cache *s = kmalloc_slab(size);