diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2009-01-16 18:31:15 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-19 16:36:02 -0500 |
commit | 31ad9081200c06ccc350625d41d1f8b2d1cef29f (patch) | |
tree | 99768cf8eae9aaa2d1f4167103aa7ea9c70068a1 /kernel/workqueue.c | |
parent | c7f8562a51c2e5dcc1a00a2bdd232b9965ff960d (diff) |
work_on_cpu: don't try to get_online_cpus() in work_on_cpu.
Impact: remove potential circular lock dependency with cpu hotplug lock
This has caused more problems than it solved, with a pile of cpu
hotplug locking issues.
Followup patches will get_online_cpus() in callers that need it, but
if they don't do it they're no worse than before when they were using
set_cpus_allowed without locking.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 2f445833ae3..a35afdbc016 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -991,8 +991,8 @@ static void do_work_for_cpu(struct work_struct *w) | |||
991 | * @fn: the function to run | 991 | * @fn: the function to run |
992 | * @arg: the function arg | 992 | * @arg: the function arg |
993 | * | 993 | * |
994 | * This will return -EINVAL in the cpu is not online, or the return value | 994 | * This will return the value @fn returns. |
995 | * of @fn otherwise. | 995 | * It is up to the caller to ensure that the cpu doesn't go offline. |
996 | */ | 996 | */ |
997 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) | 997 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) |
998 | { | 998 | { |
@@ -1001,14 +1001,8 @@ long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) | |||
1001 | INIT_WORK(&wfc.work, do_work_for_cpu); | 1001 | INIT_WORK(&wfc.work, do_work_for_cpu); |
1002 | wfc.fn = fn; | 1002 | wfc.fn = fn; |
1003 | wfc.arg = arg; | 1003 | wfc.arg = arg; |
1004 | get_online_cpus(); | 1004 | schedule_work_on(cpu, &wfc.work); |
1005 | if (unlikely(!cpu_online(cpu))) | 1005 | flush_work(&wfc.work); |
1006 | wfc.ret = -EINVAL; | ||
1007 | else { | ||
1008 | schedule_work_on(cpu, &wfc.work); | ||
1009 | flush_work(&wfc.work); | ||
1010 | } | ||
1011 | put_online_cpus(); | ||
1012 | 1006 | ||
1013 | return wfc.ret; | 1007 | return wfc.ret; |
1014 | } | 1008 | } |