1 #ifndef _LINUX_SLAB_DEF_H
2 #define _LINUX_SLAB_DEF_H
4 #include <linux/reciprocal_div.h>
7 * Definitions unique to the original Linux SLAB allocator.
11 /* 1) Cache tunables. Protected by slab_mutex */
12 unsigned int batchcount;
17 struct reciprocal_value reciprocal_buffer_size;
18 /* 2) touched by every alloc & free from the backend */
20 unsigned int flags; /* constant flags */
21 unsigned int num; /* # of objs per slab */
23 /* 3) cache_grow/shrink */
24 /* order of pgs per slab (2^n) */
25 unsigned int gfporder;
27 /* force GFP flags, e.g. GFP_DMA */
30 size_t colour; /* cache colouring range */
31 unsigned int colour_off; /* colour offset */
32 struct kmem_cache *freelist_cache;
33 unsigned int freelist_size;
35 /* constructor func */
36 void (*ctor)(void *obj);
38 /* 4) cache creation/removal */
40 struct list_head list;
46 #ifdef CONFIG_DEBUG_SLAB
47 unsigned long num_active;
48 unsigned long num_allocations;
49 unsigned long high_mark;
53 unsigned long max_freeable;
54 unsigned long node_allocs;
55 unsigned long node_frees;
56 unsigned long node_overflow;
63 * If debugging is enabled, then the allocator can add additional
64 * fields and/or padding to every object. size contains the total
65 * object size including these internal fields, the following two
66 * variables contain the offset to the user object and its size.
69 #endif /* CONFIG_DEBUG_SLAB */
70 #ifdef CONFIG_MEMCG_KMEM
71 struct memcg_cache_params *memcg_params;
74 /* 6) per-cpu/per-node data, touched during every alloc/free */
76 * We put array[] at the end of kmem_cache, because we want to size
77 * this array to nr_cpu_ids slots instead of NR_CPUS
78 * (see kmem_cache_init())
79 * We still use [NR_CPUS] and not [1] or [0] because cache_cache
80 * is statically defined, so we reserve the max number of cpus.
82 * We also need to guarantee that the list is able to accomodate a
83 * pointer for each node since "nodelists" uses the remainder of
86 struct kmem_cache_node **node;
87 struct array_cache *array[NR_CPUS + MAX_NUMNODES];
89 * Do not add fields after array[]
93 #endif /* _LINUX_SLAB_DEF_H */