0001
0002 #ifndef _TOOLS_SLAB_H
0003 #define _TOOLS_SLAB_H
0004
0005 #include <linux/types.h>
0006 #include <linux/gfp.h>
0007
0008 #define SLAB_PANIC 2
0009 #define SLAB_RECLAIM_ACCOUNT 0x00020000UL
0010
0011 #define kzalloc_node(size, flags, node) kmalloc(size, flags)
0012
0013 void *kmalloc(size_t size, gfp_t gfp);
0014 void kfree(void *p);
0015
0016 bool slab_is_available(void);
0017
0018 enum slab_state {
0019 DOWN,
0020 PARTIAL,
0021 PARTIAL_NODE,
0022 UP,
0023 FULL
0024 };
0025
0026 static inline void *kzalloc(size_t size, gfp_t gfp)
0027 {
0028 return kmalloc(size, gfp | __GFP_ZERO);
0029 }
0030
0031 struct list_lru;
0032
0033 void *kmem_cache_alloc_lru(struct kmem_cache *cachep, struct list_lru *, int flags);
0034 static inline void *kmem_cache_alloc(struct kmem_cache *cachep, int flags)
0035 {
0036 return kmem_cache_alloc_lru(cachep, NULL, flags);
0037 }
0038 void kmem_cache_free(struct kmem_cache *cachep, void *objp);
0039
0040 struct kmem_cache *kmem_cache_create(const char *name, unsigned int size,
0041 unsigned int align, unsigned int flags,
0042 void (*ctor)(void *));
0043
0044 #endif