Commit de04f79b authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[NET]: Fix per-cpu flow cache initialization.

parent 77518190
......@@ -301,6 +301,7 @@ void flow_cache_flush(void)
local_bh_disable();
smp_call_function(flow_cache_flush_per_cpu, &info, 1, 0);
if (test_bit(smp_processor_id(), &info.cpumap))
flow_cache_flush_tasklet((unsigned long)&info);
local_bh_enable();
......@@ -309,12 +310,13 @@ void flow_cache_flush(void)
up(&flow_flush_sem);
}
static void __devinit flow_cache_cpu_online(int cpu)
static void __devinit flow_cache_cpu_prepare(int cpu)
{
struct tasklet_struct *tasklet;
unsigned long order;
flow_hash_rnd_recalc(cpu) = 1;
flow_count(cpu) = 0;
for (order = 0;
(PAGE_SIZE << order) <
......@@ -329,7 +331,10 @@ static void __devinit flow_cache_cpu_online(int cpu)
tasklet = flow_flush_tasklet(cpu);
tasklet_init(tasklet, flow_cache_flush_tasklet, 0);
}
static void __devinit flow_cache_cpu_online(int cpu)
{
down(&flow_cache_cpu_sem);
set_bit(cpu, &flow_cache_cpu_map);
flow_cache_cpu_count++;
......@@ -342,6 +347,9 @@ static int __devinit flow_cache_cpu_notify(struct notifier_block *self,
unsigned long cpu = (unsigned long)cpu;
switch (action) {
case CPU_UP_PREPARE:
flow_cache_cpu_prepare(cpu);
break;
case CPU_ONLINE:
flow_cache_cpu_online(cpu);
break;
}
......@@ -354,6 +362,8 @@ static struct notifier_block __devinitdata flow_cache_cpu_nb = {
static int __init flow_cache_init(void)
{
int i;
flow_cachep = kmem_cache_create("flow_cache",
sizeof(struct flow_cache_entry),
0, SLAB_HWCACHE_ALIGN,
......@@ -371,8 +381,12 @@ static int __init flow_cache_init(void)
flow_hash_rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD;
add_timer(&flow_hash_rnd_timer);
flow_cache_cpu_online(smp_processor_id());
register_cpu_notifier(&flow_cache_cpu_nb);
for (i = 0; i < NR_CPUS; i++)
if (cpu_online(i)) {
flow_cache_cpu_prepare(i);
flow_cache_cpu_online(i);
}
return 0;
}
......
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