1 #ifndef _LINUX_SLAB_DEF_H
2 #define _LINUX_SLAB_DEF_H
5 * Definitions unique to the original Linux SLAB allocator.
9 /* 1) Cache tunables. Protected by cache_chain_mutex */
10 unsigned int batchcount;
15 u32 reciprocal_buffer_size;
16 /* 2) touched by every alloc & free from the backend */
18 unsigned int flags; /* constant flags */
19 unsigned int num; /* # of objs per slab */
21 /* 3) cache_grow/shrink */
22 /* order of pgs per slab (2^n) */
23 unsigned int gfporder;
25 /* force GFP flags, e.g. GFP_DMA */
28 size_t colour; /* cache colouring range */
29 unsigned int colour_off; /* colour offset */
30 struct kmem_cache *slabp_cache;
31 unsigned int slab_size;
33 /* constructor func */
34 void (*ctor)(void *obj);
36 /* 4) cache creation/removal */
38 struct list_head list;
44 #ifdef CONFIG_DEBUG_SLAB
45 unsigned long num_active;
46 unsigned long num_allocations;
47 unsigned long high_mark;
51 unsigned long max_freeable;
52 unsigned long node_allocs;
53 unsigned long node_frees;
54 unsigned long node_overflow;
61 * If debugging is enabled, then the allocator can add additional
62 * fields and/or padding to every object. size contains the total
63 * object size including these internal fields, the following two
64 * variables contain the offset to the user object and its size.
67 #endif /* CONFIG_DEBUG_SLAB */
68 #ifdef CONFIG_MEMCG_KMEM
69 struct memcg_cache_params *memcg_params;
72 /* 6) per-cpu/per-node data, touched during every alloc/free */
74 * We put array[] at the end of kmem_cache, because we want to size
75 * this array to nr_cpu_ids slots instead of NR_CPUS
76 * (see kmem_cache_init())
77 * We still use [NR_CPUS] and not [1] or [0] because cache_cache
78 * is statically defined, so we reserve the max number of cpus.
80 * We also need to guarantee that the list is able to accomodate a
81 * pointer for each node since "nodelists" uses the remainder of
84 struct kmem_cache_node **node;
85 struct array_cache *array[NR_CPUS + MAX_NUMNODES];
87 * Do not add fields after array[]
91 #endif /* _LINUX_SLAB_DEF_H */