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. This may be necessary in order for cache_reap to run on a different cpu if the processor is shut down. However, we are unsure at this point about how safe doing so is. If there are slab operations in progress on the cpu that cache_reap was redirected to then we m Signed-off-by: Christoph Lameter Index: linux-2.6.20-rc6/mm/slab.c =================================================================== --- linux-2.6.20-rc6.orig/mm/slab.c 2007-01-29 13:44:15.999843374 -0600 +++ linux-2.6.20-rc6/mm/slab.c 2007-01-29 13:45:07.412596291 -0600 @@ -4022,18 +4022,17 @@ void drain_array(struct kmem_cache *cach * If we cannot acquire the cache chain mutex then just give up - we'll try * again on the next iteration. */ -static void cache_reap(struct work_struct *unused) +static void cache_reap(struct work_struct *w) { struct kmem_cache *searchp; struct kmem_list3 *l3; int node = numa_node_id(); + struct delayed_work *work = + container_of(w, struct delayed_work, work); - if (!mutex_trylock(&cache_chain_mutex)) { + if (!mutex_trylock(&cache_chain_mutex)) /* Give up. Setup the next iteration. */ - schedule_delayed_work(&__get_cpu_var(reap_work), - round_jiffies_relative(REAPTIMEOUT_CPUC)); - return; - } + goto out; list_for_each_entry(searchp, &cache_chain, next) { check_irq_on(); @@ -4076,9 +4075,9 @@ next: mutex_unlock(&cache_chain_mutex); next_reap_node(); refresh_cpu_vm_stats(smp_processor_id()); +out: /* Set up the next iteration */ - schedule_delayed_work(&__get_cpu_var(reap_work), - round_jiffies_relative(REAPTIMEOUT_CPUC)); + schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC)); } #ifdef CONFIG_PROC_FS