slob_def.h 969 字节
Newer Older
P
Paul Mundt 已提交
1 2 3
#ifndef __LINUX_SLOB_DEF_H
#define __LINUX_SLOB_DEF_H

4 5
#include <linux/numa.h>

P
Paul Mundt 已提交
6 7
void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);

E
Eduard - Gabriel Munteanu 已提交
8 9
static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
					      gfp_t flags)
P
Paul Mundt 已提交
10
{
11
	return kmem_cache_alloc_node(cachep, flags, NUMA_NO_NODE);
P
Paul Mundt 已提交
12 13 14 15
}

void *__kmalloc_node(size_t size, gfp_t flags, int node);

E
Eduard - Gabriel Munteanu 已提交
16
static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
P
Paul Mundt 已提交
17 18 19 20 21 22 23 24 25 26 27 28
{
	return __kmalloc_node(size, flags, node);
}

/**
 * kmalloc - allocate memory
 * @size: how many bytes of memory are required.
 * @flags: the type of memory to allocate (see kcalloc).
 *
 * kmalloc is the normal method of allocating memory
 * in the kernel.
 */
E
Eduard - Gabriel Munteanu 已提交
29
static __always_inline void *kmalloc(size_t size, gfp_t flags)
P
Paul Mundt 已提交
30
{
31
	return __kmalloc_node(size, flags, NUMA_NO_NODE);
P
Paul Mundt 已提交
32 33
}

E
Eduard - Gabriel Munteanu 已提交
34
static __always_inline void *__kmalloc(size_t size, gfp_t flags)
P
Paul Mundt 已提交
35 36 37 38 39
{
	return kmalloc(size, flags);
}

#endif /* __LINUX_SLOB_DEF_H */