blob: 4382db09df4f1820ee48056ee5b8fe93dee0d3e5 [file] [log] [blame]
Paul Mundt6193a2f2007-07-15 23:38:22 -07001#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H
3
FUJITA Tomonoria6eb9fe2010-08-10 18:03:22 -07004#ifdef ARCH_DMA_MINALIGN
5#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
6#else
David Woodhousebac49ce2010-05-19 12:01:43 +01007#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
8#endif
9
10#ifndef ARCH_SLAB_MINALIGN
11#define ARCH_SLAB_MINALIGN __alignof__(unsigned long)
12#endif
13
Paul Mundt6193a2f2007-07-15 23:38:22 -070014void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
15
Eduard - Gabriel Munteanu3eae2cb22008-08-10 20:14:07 +030016static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
17 gfp_t flags)
Paul Mundt6193a2f2007-07-15 23:38:22 -070018{
19 return kmem_cache_alloc_node(cachep, flags, -1);
20}
21
22void *__kmalloc_node(size_t size, gfp_t flags, int node);
23
Eduard - Gabriel Munteanu3eae2cb22008-08-10 20:14:07 +030024static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
Paul Mundt6193a2f2007-07-15 23:38:22 -070025{
26 return __kmalloc_node(size, flags, node);
27}
28
29/**
30 * kmalloc - allocate memory
31 * @size: how many bytes of memory are required.
32 * @flags: the type of memory to allocate (see kcalloc).
33 *
34 * kmalloc is the normal method of allocating memory
35 * in the kernel.
36 */
Eduard - Gabriel Munteanu3eae2cb22008-08-10 20:14:07 +030037static __always_inline void *kmalloc(size_t size, gfp_t flags)
Paul Mundt6193a2f2007-07-15 23:38:22 -070038{
39 return __kmalloc_node(size, flags, -1);
40}
41
Eduard - Gabriel Munteanu3eae2cb22008-08-10 20:14:07 +030042static __always_inline void *__kmalloc(size_t size, gfp_t flags)
Paul Mundt6193a2f2007-07-15 23:38:22 -070043{
44 return kmalloc(size, flags);
45}
46
Paul Mundt6193a2f2007-07-15 23:38:22 -070047#endif /* __LINUX_SLOB_DEF_H */