aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux.com>2012-05-09 11:09:51 -0400
committerPekka Enberg <penberg@kernel.org>2012-06-01 02:25:40 -0400
commit6faa68337b0c90923a1405ae9c196cee64921b7e (patch)
treee15596c4cb0afea05263148221f5a0d8ccbb6d08 /mm/slub.c
parent76e10d158efb6d4516018846f60c2ab5501900bc (diff)
slub: Use freelist instead of "object" in __slab_alloc
The variable "object" really refers to a list of objects that we are handling. Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 80848cd3901c..83f258298de7 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2127,7 +2127,7 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
2127static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags, 2127static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags,
2128 int node, struct kmem_cache_cpu **pc) 2128 int node, struct kmem_cache_cpu **pc)
2129{ 2129{
2130 void *object; 2130 void *freelist;
2131 struct kmem_cache_cpu *c; 2131 struct kmem_cache_cpu *c;
2132 struct page *page = new_slab(s, flags, node); 2132 struct page *page = new_slab(s, flags, node);
2133 2133
@@ -2140,7 +2140,7 @@ static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags,
2140 * No other reference to the page yet so we can 2140 * No other reference to the page yet so we can
2141 * muck around with it freely without cmpxchg 2141 * muck around with it freely without cmpxchg
2142 */ 2142 */
2143 object = page->freelist; 2143 freelist = page->freelist;
2144 page->freelist = NULL; 2144 page->freelist = NULL;
2145 2145
2146 stat(s, ALLOC_SLAB); 2146 stat(s, ALLOC_SLAB);
@@ -2148,9 +2148,9 @@ static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags,
2148 c->page = page; 2148 c->page = page;
2149 *pc = c; 2149 *pc = c;
2150 } else 2150 } else
2151 object = NULL; 2151 freelist = NULL;
2152 2152
2153 return object; 2153 return freelist;
2154} 2154}
2155 2155
2156/* 2156/*
@@ -2170,6 +2170,7 @@ static inline void *get_freelist(struct kmem_cache *s, struct page *page)
2170 do { 2170 do {
2171 freelist = page->freelist; 2171 freelist = page->freelist;
2172 counters = page->counters; 2172 counters = page->counters;
2173
2173 new.counters = counters; 2174 new.counters = counters;
2174 VM_BUG_ON(!new.frozen); 2175 VM_BUG_ON(!new.frozen);
2175 2176
@@ -2203,7 +2204,7 @@ static inline void *get_freelist(struct kmem_cache *s, struct page *page)
2203static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, 2204static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
2204 unsigned long addr, struct kmem_cache_cpu *c) 2205 unsigned long addr, struct kmem_cache_cpu *c)
2205{ 2206{
2206 void **object; 2207 void *freelist;
2207 unsigned long flags; 2208 unsigned long flags;
2208 2209
2209 local_irq_save(flags); 2210 local_irq_save(flags);
@@ -2219,6 +2220,7 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
2219 if (!c->page) 2220 if (!c->page)
2220 goto new_slab; 2221 goto new_slab;
2221redo: 2222redo:
2223
2222 if (unlikely(!node_match(c, node))) { 2224 if (unlikely(!node_match(c, node))) {
2223 stat(s, ALLOC_NODE_MISMATCH); 2225 stat(s, ALLOC_NODE_MISMATCH);
2224 deactivate_slab(s, c); 2226 deactivate_slab(s, c);
@@ -2226,15 +2228,15 @@ redo:
2226 } 2228 }
2227 2229
2228 /* must check again c->freelist in case of cpu migration or IRQ */ 2230 /* must check again c->freelist in case of cpu migration or IRQ */
2229 object = c->freelist; 2231 freelist = c->freelist;
2230 if (object) 2232 if (freelist)
2231 goto load_freelist; 2233 goto load_freelist;
2232 2234
2233 stat(s, ALLOC_SLOWPATH); 2235 stat(s, ALLOC_SLOWPATH);
2234 2236
2235 object = get_freelist(s, c->page); 2237 freelist = get_freelist(s, c->page);
2236 2238
2237 if (!object) { 2239 if (!freelist) {
2238 c->page = NULL; 2240 c->page = NULL;
2239 stat(s, DEACTIVATE_BYPASS); 2241 stat(s, DEACTIVATE_BYPASS);
2240 goto new_slab; 2242 goto new_slab;
@@ -2243,10 +2245,10 @@ redo:
2243 stat(s, ALLOC_REFILL); 2245 stat(s, ALLOC_REFILL);
2244 2246
2245load_freelist: 2247load_freelist:
2246 c->freelist = get_freepointer(s, object); 2248 c->freelist = get_freepointer(s, freelist);
2247 c->tid = next_tid(c->tid); 2249 c->tid = next_tid(c->tid);
2248 local_irq_restore(flags); 2250 local_irq_restore(flags);
2249 return object; 2251 return freelist;
2250 2252
2251new_slab: 2253new_slab:
2252 2254
@@ -2260,13 +2262,13 @@ new_slab:
2260 } 2262 }
2261 2263
2262 /* Then do expensive stuff like retrieving pages from the partial lists */ 2264 /* Then do expensive stuff like retrieving pages from the partial lists */
2263 object = get_partial(s, gfpflags, node, c); 2265 freelist = get_partial(s, gfpflags, node, c);
2264 2266
2265 if (unlikely(!object)) { 2267 if (unlikely(!freelist)) {
2266 2268
2267 object = new_slab_objects(s, gfpflags, node, &c); 2269 freelist = new_slab_objects(s, gfpflags, node, &c);
2268 2270
2269 if (unlikely(!object)) { 2271 if (unlikely(!freelist)) {
2270 if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit()) 2272 if (!(gfpflags & __GFP_NOWARN) && printk_ratelimit())
2271 slab_out_of_memory(s, gfpflags, node); 2273 slab_out_of_memory(s, gfpflags, node);
2272 2274
@@ -2279,14 +2281,14 @@ new_slab:
2279 goto load_freelist; 2281 goto load_freelist;
2280 2282
2281 /* Only entered in the debug case */ 2283 /* Only entered in the debug case */
2282 if (!alloc_debug_processing(s, c->page, object, addr)) 2284 if (!alloc_debug_processing(s, c->page, freelist, addr))
2283 goto new_slab; /* Slab failed checks. Next slab needed */ 2285 goto new_slab; /* Slab failed checks. Next slab needed */
2284 2286
2285 c->freelist = get_freepointer(s, object); 2287 c->freelist = get_freepointer(s, freelist);
2286 deactivate_slab(s, c); 2288 deactivate_slab(s, c);
2287 c->node = NUMA_NO_NODE; 2289 c->node = NUMA_NO_NODE;
2288 local_irq_restore(flags); 2290 local_irq_restore(flags);
2289 return object; 2291 return freelist;
2290} 2292}
2291 2293
2292/* 2294/*