Index: kernel-source-2.5/net/core/flow.c =================================================================== RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.5/net/core/flow.c,v retrieving revision 1.5 diff -u -r1.5 flow.c --- kernel-source-2.5/net/core/flow.c 13 Jun 2003 11:22:17 -0000 1.5 +++ kernel-source-2.5/net/core/flow.c 19 Jun 2003 09:23:38 -0000 @@ -300,7 +300,8 @@ local_bh_disable(); smp_call_function(flow_cache_flush_per_cpu, &info, 1, 0); - flow_cache_flush_tasklet((unsigned long)&info); + if (test_bit(smp_processor_id(), &info.cpumap)) + flow_cache_flush_tasklet((unsigned long)&info); local_bh_enable(); wait_for_completion(&info.completion); @@ -308,12 +309,13 @@ 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) < @@ -328,7 +330,10 @@ 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++; @@ -341,6 +346,9 @@ 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; } @@ -353,6 +361,8 @@ 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, @@ -370,8 +380,12 @@ 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; }