Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] slab: use parameter passed to cache_reap to determine pointer to work structure

Use the pointer passed to cache_reap to determine the work pointer and
consolidate exit paths.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Christoph Lameter and committed by
Linus Torvalds
7c5cae36 8c8cc2c1

+7 -8
+7 -8
mm/slab.c
··· 4029 4029 * If we cannot acquire the cache chain mutex then just give up - we'll try 4030 4030 * again on the next iteration. 4031 4031 */ 4032 - static void cache_reap(struct work_struct *unused) 4032 + static void cache_reap(struct work_struct *w) 4033 4033 { 4034 4034 struct kmem_cache *searchp; 4035 4035 struct kmem_list3 *l3; 4036 4036 int node = numa_node_id(); 4037 + struct delayed_work *work = 4038 + container_of(w, struct delayed_work, work); 4037 4039 4038 - if (!mutex_trylock(&cache_chain_mutex)) { 4040 + if (!mutex_trylock(&cache_chain_mutex)) 4039 4041 /* Give up. Setup the next iteration. */ 4040 - schedule_delayed_work(&__get_cpu_var(reap_work), 4041 - round_jiffies_relative(REAPTIMEOUT_CPUC)); 4042 - return; 4043 - } 4042 + goto out; 4044 4043 4045 4044 list_for_each_entry(searchp, &cache_chain, next) { 4046 4045 check_irq_on(); ··· 4082 4083 mutex_unlock(&cache_chain_mutex); 4083 4084 next_reap_node(); 4084 4085 refresh_cpu_vm_stats(smp_processor_id()); 4086 + out: 4085 4087 /* Set up the next iteration */ 4086 - schedule_delayed_work(&__get_cpu_var(reap_work), 4087 - round_jiffies_relative(REAPTIMEOUT_CPUC)); 4088 + schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC)); 4088 4089 } 4089 4090 4090 4091 #ifdef CONFIG_PROC_FS