Commit fa652753 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] slab: take the spinlock in the drain function.

In 2.5, local_irq_disable() provides protection against
smp_call_function() on all architectures.  (Or it will, not sure.  But
davem says this is OK).

So a spin_lock() within the smp_call_function() callback is now
permitted, and we can remove/cleanup the workaround.
parent 69e74939
......@@ -917,29 +917,19 @@ static void do_ccupdate_local(void *info)
static void free_block (kmem_cache_t* cachep, void** objpp, int len);
static void drain_cpu_caches(kmem_cache_t *cachep)
static void do_drain(void *arg)
{
ccupdate_struct_t new;
int i;
kmem_cache_t *cachep = (kmem_cache_t*)arg;
cpucache_t *cc;
memset(&new.new,0,sizeof(new.new));
new.cachep = cachep;
down(&cache_chain_sem);
smp_call_function_all_cpus(do_ccupdate_local, (void *)&new);
cc = cc_data(cachep);
free_block(cachep, &cc_entry(cc)[0], cc->avail);
cc->avail = 0;
}
for (i = 0; i < NR_CPUS; i++) {
cpucache_t* ccold = new.new[i];
if (!ccold || (ccold->avail == 0))
continue;
local_irq_disable();
free_block(cachep, cc_entry(ccold), ccold->avail);
local_irq_enable();
ccold->avail = 0;
}
smp_call_function_all_cpus(do_ccupdate_local, (void *)&new);
up(&cache_chain_sem);
static void drain_cpu_caches(kmem_cache_t *cachep)
{
smp_call_function_all_cpus(do_drain, cachep);
}
static int __cache_shrink(kmem_cache_t *cachep)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment