Commit e1d9ec62 authored by Rusty Russell's avatar Rusty Russell Committed by Mike Travis

work_on_cpu: Use our own workqueue.

Impact: remove potential clashes with generic kevent workqueue

Annoyingly, some places we want to use work_on_cpu are already in
workqueues.  As per Ingo's suggestion, we create a different workqueue
for work_on_cpu.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarMike Travis <travis@sgi.com>
parent 68564a46
...@@ -971,6 +971,8 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb, ...@@ -971,6 +971,8 @@ static int __devinit workqueue_cpu_callback(struct notifier_block *nfb,
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
static struct workqueue_struct *work_on_cpu_wq __read_mostly;
struct work_for_cpu { struct work_for_cpu {
struct work_struct work; struct work_struct work;
long (*fn)(void *); long (*fn)(void *);
...@@ -1001,7 +1003,7 @@ long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) ...@@ -1001,7 +1003,7 @@ long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)
INIT_WORK(&wfc.work, do_work_for_cpu); INIT_WORK(&wfc.work, do_work_for_cpu);
wfc.fn = fn; wfc.fn = fn;
wfc.arg = arg; wfc.arg = arg;
schedule_work_on(cpu, &wfc.work); queue_work_on(cpu, work_on_cpu_wq, &wfc.work);
flush_work(&wfc.work); flush_work(&wfc.work);
return wfc.ret; return wfc.ret;
...@@ -1019,4 +1021,8 @@ void __init init_workqueues(void) ...@@ -1019,4 +1021,8 @@ void __init init_workqueues(void)
hotcpu_notifier(workqueue_cpu_callback, 0); hotcpu_notifier(workqueue_cpu_callback, 0);
keventd_wq = create_workqueue("events"); keventd_wq = create_workqueue("events");
BUG_ON(!keventd_wq); BUG_ON(!keventd_wq);
#ifdef CONFIG_SMP
work_on_cpu_wq = create_workqueue("work_on_cpu");
BUG_ON(!work_on_cpu_wq);
#endif
} }
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