aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/mm/slab.c b/mm/slab.c
index c2f9e0a330ff..b19093864998 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -679,7 +679,7 @@ static void enable_cpucache(kmem_cache_t *cachep);
679static void cache_reap(void *unused); 679static void cache_reap(void *unused);
680static int __node_shrink(kmem_cache_t *cachep, int node); 680static int __node_shrink(kmem_cache_t *cachep, int node);
681 681
682static inline struct array_cache *ac_data(kmem_cache_t *cachep) 682static inline struct array_cache *cpu_cache_get(kmem_cache_t *cachep)
683{ 683{
684 return cachep->array[smp_processor_id()]; 684 return cachep->array[smp_processor_id()];
685} 685}
@@ -1186,8 +1186,8 @@ void __init kmem_cache_init(void)
1186 ptr = kmalloc(sizeof(struct arraycache_init), GFP_KERNEL); 1186 ptr = kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
1187 1187
1188 local_irq_disable(); 1188 local_irq_disable();
1189 BUG_ON(ac_data(&cache_cache) != &initarray_cache.cache); 1189 BUG_ON(cpu_cache_get(&cache_cache) != &initarray_cache.cache);
1190 memcpy(ptr, ac_data(&cache_cache), 1190 memcpy(ptr, cpu_cache_get(&cache_cache),
1191 sizeof(struct arraycache_init)); 1191 sizeof(struct arraycache_init));
1192 cache_cache.array[smp_processor_id()] = ptr; 1192 cache_cache.array[smp_processor_id()] = ptr;
1193 local_irq_enable(); 1193 local_irq_enable();
@@ -1195,9 +1195,9 @@ void __init kmem_cache_init(void)
1195 ptr = kmalloc(sizeof(struct arraycache_init), GFP_KERNEL); 1195 ptr = kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
1196 1196
1197 local_irq_disable(); 1197 local_irq_disable();
1198 BUG_ON(ac_data(malloc_sizes[INDEX_AC].cs_cachep) 1198 BUG_ON(cpu_cache_get(malloc_sizes[INDEX_AC].cs_cachep)
1199 != &initarray_generic.cache); 1199 != &initarray_generic.cache);
1200 memcpy(ptr, ac_data(malloc_sizes[INDEX_AC].cs_cachep), 1200 memcpy(ptr, cpu_cache_get(malloc_sizes[INDEX_AC].cs_cachep),
1201 sizeof(struct arraycache_init)); 1201 sizeof(struct arraycache_init));
1202 malloc_sizes[INDEX_AC].cs_cachep->array[smp_processor_id()] = 1202 malloc_sizes[INDEX_AC].cs_cachep->array[smp_processor_id()] =
1203 ptr; 1203 ptr;
@@ -1235,7 +1235,7 @@ void __init kmem_cache_init(void)
1235 g_cpucache_up = FULL; 1235 g_cpucache_up = FULL;
1236 1236
1237 /* Register a cpu startup notifier callback 1237 /* Register a cpu startup notifier callback
1238 * that initializes ac_data for all new cpus 1238 * that initializes cpu_cache_get for all new cpus
1239 */ 1239 */
1240 register_cpu_notifier(&cpucache_notifier); 1240 register_cpu_notifier(&cpucache_notifier);
1241 1241
@@ -1909,11 +1909,11 @@ kmem_cache_create (const char *name, size_t size, size_t align,
1909 jiffies + REAPTIMEOUT_LIST3 + 1909 jiffies + REAPTIMEOUT_LIST3 +
1910 ((unsigned long)cachep) % REAPTIMEOUT_LIST3; 1910 ((unsigned long)cachep) % REAPTIMEOUT_LIST3;
1911 1911
1912 BUG_ON(!ac_data(cachep)); 1912 BUG_ON(!cpu_cache_get(cachep));
1913 ac_data(cachep)->avail = 0; 1913 cpu_cache_get(cachep)->avail = 0;
1914 ac_data(cachep)->limit = BOOT_CPUCACHE_ENTRIES; 1914 cpu_cache_get(cachep)->limit = BOOT_CPUCACHE_ENTRIES;
1915 ac_data(cachep)->batchcount = 1; 1915 cpu_cache_get(cachep)->batchcount = 1;
1916 ac_data(cachep)->touched = 0; 1916 cpu_cache_get(cachep)->touched = 0;
1917 cachep->batchcount = 1; 1917 cachep->batchcount = 1;
1918 cachep->limit = BOOT_CPUCACHE_ENTRIES; 1918 cachep->limit = BOOT_CPUCACHE_ENTRIES;
1919 } 1919 }
@@ -1992,7 +1992,7 @@ static void do_drain(void *arg)
1992 int node = numa_node_id(); 1992 int node = numa_node_id();
1993 1993
1994 check_irq_off(); 1994 check_irq_off();
1995 ac = ac_data(cachep); 1995 ac = cpu_cache_get(cachep);
1996 spin_lock(&cachep->nodelists[node]->list_lock); 1996 spin_lock(&cachep->nodelists[node]->list_lock);
1997 free_block(cachep, ac->entry, ac->avail, node); 1997 free_block(cachep, ac->entry, ac->avail, node);
1998 spin_unlock(&cachep->nodelists[node]->list_lock); 1998 spin_unlock(&cachep->nodelists[node]->list_lock);
@@ -2518,7 +2518,7 @@ static void *cache_alloc_refill(kmem_cache_t *cachep, gfp_t flags)
2518 struct array_cache *ac; 2518 struct array_cache *ac;
2519 2519
2520 check_irq_off(); 2520 check_irq_off();
2521 ac = ac_data(cachep); 2521 ac = cpu_cache_get(cachep);
2522 retry: 2522 retry:
2523 batchcount = ac->batchcount; 2523 batchcount = ac->batchcount;
2524 if (!ac->touched && batchcount > BATCHREFILL_LIMIT) { 2524 if (!ac->touched && batchcount > BATCHREFILL_LIMIT) {
@@ -2590,7 +2590,7 @@ static void *cache_alloc_refill(kmem_cache_t *cachep, gfp_t flags)
2590 x = cache_grow(cachep, flags, numa_node_id()); 2590 x = cache_grow(cachep, flags, numa_node_id());
2591 2591
2592 // cache_grow can reenable interrupts, then ac could change. 2592 // cache_grow can reenable interrupts, then ac could change.
2593 ac = ac_data(cachep); 2593 ac = cpu_cache_get(cachep);
2594 if (!x && ac->avail == 0) // no objects in sight? abort 2594 if (!x && ac->avail == 0) // no objects in sight? abort
2595 return NULL; 2595 return NULL;
2596 2596
@@ -2675,7 +2675,7 @@ static inline void *____cache_alloc(kmem_cache_t *cachep, gfp_t flags)
2675#endif 2675#endif
2676 2676
2677 check_irq_off(); 2677 check_irq_off();
2678 ac = ac_data(cachep); 2678 ac = cpu_cache_get(cachep);
2679 if (likely(ac->avail)) { 2679 if (likely(ac->avail)) {
2680 STATS_INC_ALLOCHIT(cachep); 2680 STATS_INC_ALLOCHIT(cachep);
2681 ac->touched = 1; 2681 ac->touched = 1;
@@ -2868,7 +2868,7 @@ static void cache_flusharray(kmem_cache_t *cachep, struct array_cache *ac)
2868 */ 2868 */
2869static inline void __cache_free(kmem_cache_t *cachep, void *objp) 2869static inline void __cache_free(kmem_cache_t *cachep, void *objp)
2870{ 2870{
2871 struct array_cache *ac = ac_data(cachep); 2871 struct array_cache *ac = cpu_cache_get(cachep);
2872 2872
2873 check_irq_off(); 2873 check_irq_off();
2874 objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0)); 2874 objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
@@ -3253,7 +3253,7 @@ static void do_ccupdate_local(void *info)
3253 struct array_cache *old; 3253 struct array_cache *old;
3254 3254
3255 check_irq_off(); 3255 check_irq_off();
3256 old = ac_data(new->cachep); 3256 old = cpu_cache_get(new->cachep);
3257 3257
3258 new->cachep->array[smp_processor_id()] = new->new[smp_processor_id()]; 3258 new->cachep->array[smp_processor_id()] = new->new[smp_processor_id()];
3259 new->new[smp_processor_id()] = old; 3259 new->new[smp_processor_id()] = old;
@@ -3419,7 +3419,7 @@ static void cache_reap(void *unused)
3419 drain_alien_cache(searchp, l3); 3419 drain_alien_cache(searchp, l3);
3420 spin_lock_irq(&l3->list_lock); 3420 spin_lock_irq(&l3->list_lock);
3421 3421
3422 drain_array_locked(searchp, ac_data(searchp), 0, 3422 drain_array_locked(searchp, cpu_cache_get(searchp), 0,
3423 numa_node_id()); 3423 numa_node_id());
3424 3424
3425 if (time_after(l3->next_reap, jiffies)) 3425 if (time_after(l3->next_reap, jiffies))