Paul Mundt | 6193a2f | 2007-07-15 23:38:22 -0700 | [diff] [blame] | 1 | #ifndef __LINUX_SLOB_DEF_H |
| 2 | #define __LINUX_SLOB_DEF_H |
| 3 | |
David Woodhouse | bac49ce | 2010-05-19 12:01:43 +0100 | [diff] [blame] | 4 | #ifndef ARCH_KMALLOC_MINALIGN |
| 5 | #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long) |
| 6 | #endif |
| 7 | |
| 8 | #ifndef ARCH_SLAB_MINALIGN |
| 9 | #define ARCH_SLAB_MINALIGN __alignof__(unsigned long) |
| 10 | #endif |
| 11 | |
Paul Mundt | 6193a2f | 2007-07-15 23:38:22 -0700 | [diff] [blame] | 12 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
| 13 | |
Eduard - Gabriel Munteanu | 3eae2cb2 | 2008-08-10 20:14:07 +0300 | [diff] [blame] | 14 | static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, |
| 15 | gfp_t flags) |
Paul Mundt | 6193a2f | 2007-07-15 23:38:22 -0700 | [diff] [blame] | 16 | { |
| 17 | return kmem_cache_alloc_node(cachep, flags, -1); |
| 18 | } |
| 19 | |
| 20 | void *__kmalloc_node(size_t size, gfp_t flags, int node); |
| 21 | |
Eduard - Gabriel Munteanu | 3eae2cb2 | 2008-08-10 20:14:07 +0300 | [diff] [blame] | 22 | static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) |
Paul Mundt | 6193a2f | 2007-07-15 23:38:22 -0700 | [diff] [blame] | 23 | { |
| 24 | return __kmalloc_node(size, flags, node); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * kmalloc - allocate memory |
| 29 | * @size: how many bytes of memory are required. |
| 30 | * @flags: the type of memory to allocate (see kcalloc). |
| 31 | * |
| 32 | * kmalloc is the normal method of allocating memory |
| 33 | * in the kernel. |
| 34 | */ |
Eduard - Gabriel Munteanu | 3eae2cb2 | 2008-08-10 20:14:07 +0300 | [diff] [blame] | 35 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
Paul Mundt | 6193a2f | 2007-07-15 23:38:22 -0700 | [diff] [blame] | 36 | { |
| 37 | return __kmalloc_node(size, flags, -1); |
| 38 | } |
| 39 | |
Eduard - Gabriel Munteanu | 3eae2cb2 | 2008-08-10 20:14:07 +0300 | [diff] [blame] | 40 | static __always_inline void *__kmalloc(size_t size, gfp_t flags) |
Paul Mundt | 6193a2f | 2007-07-15 23:38:22 -0700 | [diff] [blame] | 41 | { |
| 42 | return kmalloc(size, flags); |
| 43 | } |
| 44 | |
Paul Mundt | 6193a2f | 2007-07-15 23:38:22 -0700 | [diff] [blame] | 45 | #endif /* __LINUX_SLOB_DEF_H */ |