[PATCH] kthread_bind new worker threads when onlining cpu

From: Nathan Lynch
Date: Tue Feb 15 2005 - 21:08:18 EST


Hi Andrew-

On Tue, Feb 15, 2005 at 08:02:17AM +0100, Ingo Molnar wrote:
>
> * Nathan Lynch <ntl@xxxxxxxxx> wrote:
>
> >
> > It looks as if we need to explicitly bind worker threads to a newly
> > onlined cpu. This gets rid of the smp_processor_id warnings from
> > cache_reap. Adding a little more instrumentation to the debug
> > smp_processor_id showed that new worker threads were actually running
> > on the wrong cpu...
> >
> > Does this look ok?
>
> indeed - looks much better than the 'turn off the warning' solution.
>
> Acked-by: Ingo Molnar <mingo@xxxxxxx>

We weren't binding new worker threads to their cpu when onlining.
Using preempt and the debug version of smp_processor_id found this.

Signed-off-by: Nathan Lynch <ntl@xxxxxxxxx>

Index: linux-2.6.11-rc4-bk2/kernel/workqueue.c
===================================================================
--- linux-2.6.11-rc4-bk2.orig/kernel/workqueue.c 2005-02-14 11:13:08.000000000 -0600
+++ linux-2.6.11-rc4-bk2/kernel/workqueue.c 2005-02-14 15:18:35.000000000 -0600
@@ -485,8 +485,10 @@

case CPU_ONLINE:
/* Kick off worker threads. */
- list_for_each_entry(wq, &workqueues, list)
+ list_for_each_entry(wq, &workqueues, list) {
+ kthread_bind(wq->cpu_wq[hotcpu].thread, hotcpu);
wake_up_process(wq->cpu_wq[hotcpu].thread);
+ }
break;

case CPU_UP_CANCELED:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/