diff options
| author | Ingo Molnar <mingo@elte.hu> | 2009-02-25 16:40:10 +0100 | 
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-02-25 16:40:10 +0100 | 
| commit | 2e31add2a7e2a15d07f592c21ba35870fa9a1d1f (patch) | |
| tree | 814e2c70fb5528f108114c0da6e5a1e219e6a0e1 /kernel/workqueue.c | |
| parent | d639bab8da86d330493487e8c0fea8ca31f53427 (diff) | |
| parent | 17581ad812a9abb0182260374ef2e52d4a808a64 (diff) | |
Merge branch 'x86/urgent' into x86/pat
Diffstat (limited to 'kernel/workqueue.c')
| -rw-r--r-- | kernel/workqueue.c | 20 | 
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 2f445833ae37..1f0c509b40d3 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -971,6 +971,8 @@ undo:  }  #ifdef CONFIG_SMP +static struct workqueue_struct *work_on_cpu_wq __read_mostly; +  struct work_for_cpu {  	struct work_struct work;  	long (*fn)(void *); @@ -991,8 +993,8 @@ static void do_work_for_cpu(struct work_struct *w)   * @fn: the function to run   * @arg: the function arg   * - * This will return -EINVAL in the cpu is not online, or the return value - * of @fn otherwise. + * This will return the value @fn returns. + * It is up to the caller to ensure that the cpu doesn't go offline.   */  long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)  { @@ -1001,14 +1003,8 @@ long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)  	INIT_WORK(&wfc.work, do_work_for_cpu);  	wfc.fn = fn;  	wfc.arg = arg; -	get_online_cpus(); -	if (unlikely(!cpu_online(cpu))) -		wfc.ret = -EINVAL; -	else { -		schedule_work_on(cpu, &wfc.work); -		flush_work(&wfc.work); -	} -	put_online_cpus(); +	queue_work_on(cpu, work_on_cpu_wq, &wfc.work); +	flush_work(&wfc.work);  	return wfc.ret;  } @@ -1025,4 +1021,8 @@ void __init init_workqueues(void)  	hotcpu_notifier(workqueue_cpu_callback, 0);  	keventd_wq = create_workqueue("events");  	BUG_ON(!keventd_wq); +#ifdef CONFIG_SMP +	work_on_cpu_wq = create_workqueue("work_on_cpu"); +	BUG_ON(!work_on_cpu_wq); +#endif  }  | 
