aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/slub_def.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/slub_def.h')
-rw-r--r--include/linux/slub_def.h27
1 files changed, 12 insertions, 15 deletions
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 1e14beb23f9b..0249d4175bac 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -38,8 +38,6 @@ struct kmem_cache_cpu {
38 void **freelist; /* Pointer to first free per cpu object */ 38 void **freelist; /* Pointer to first free per cpu object */
39 struct page *page; /* The slab from which we are allocating */ 39 struct page *page; /* The slab from which we are allocating */
40 int node; /* The node of the page (or -1 for debug) */ 40 int node; /* The node of the page (or -1 for debug) */
41 unsigned int offset; /* Freepointer offset (in word units) */
42 unsigned int objsize; /* Size of an object (from kmem_cache) */
43#ifdef CONFIG_SLUB_STATS 41#ifdef CONFIG_SLUB_STATS
44 unsigned stat[NR_SLUB_STAT_ITEMS]; 42 unsigned stat[NR_SLUB_STAT_ITEMS];
45#endif 43#endif
@@ -69,6 +67,7 @@ struct kmem_cache_order_objects {
69 * Slab cache management. 67 * Slab cache management.
70 */ 68 */
71struct kmem_cache { 69struct kmem_cache {
70 struct kmem_cache_cpu *cpu_slab;
72 /* Used for retriving partial slabs etc */ 71 /* Used for retriving partial slabs etc */
73 unsigned long flags; 72 unsigned long flags;
74 int size; /* The size of an object including meta data */ 73 int size; /* The size of an object including meta data */
@@ -104,11 +103,6 @@ struct kmem_cache {
104 int remote_node_defrag_ratio; 103 int remote_node_defrag_ratio;
105 struct kmem_cache_node *node[MAX_NUMNODES]; 104 struct kmem_cache_node *node[MAX_NUMNODES];
106#endif 105#endif
107#ifdef CONFIG_SMP
108 struct kmem_cache_cpu *cpu_slab[NR_CPUS];
109#else
110 struct kmem_cache_cpu cpu_slab;
111#endif
112}; 106};
113 107
114/* 108/*
@@ -135,11 +129,21 @@ struct kmem_cache {
135 129
136#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2) 130#define SLUB_PAGE_SHIFT (PAGE_SHIFT + 2)
137 131
132#ifdef CONFIG_ZONE_DMA
133#define SLUB_DMA __GFP_DMA
134/* Reserve extra caches for potential DMA use */
135#define KMALLOC_CACHES (2 * SLUB_PAGE_SHIFT - 6)
136#else
137/* Disable DMA functionality */
138#define SLUB_DMA (__force gfp_t)0
139#define KMALLOC_CACHES SLUB_PAGE_SHIFT
140#endif
141
138/* 142/*
139 * We keep the general caches in an array of slab caches that are used for 143 * We keep the general caches in an array of slab caches that are used for
140 * 2^x bytes of allocations. 144 * 2^x bytes of allocations.
141 */ 145 */
142extern struct kmem_cache kmalloc_caches[SLUB_PAGE_SHIFT]; 146extern struct kmem_cache kmalloc_caches[KMALLOC_CACHES];
143 147
144/* 148/*
145 * Sorry that the following has to be that ugly but some versions of GCC 149 * Sorry that the following has to be that ugly but some versions of GCC
@@ -207,13 +211,6 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
207 return &kmalloc_caches[index]; 211 return &kmalloc_caches[index];
208} 212}
209 213
210#ifdef CONFIG_ZONE_DMA
211#define SLUB_DMA __GFP_DMA
212#else
213/* Disable DMA functionality */
214#define SLUB_DMA (__force gfp_t)0
215#endif
216
217void *kmem_cache_alloc(struct kmem_cache *, gfp_t); 214void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
218void *__kmalloc(size_t size, gfp_t flags); 215void *__kmalloc(size_t size, gfp_t flags);
219 216