History

Merge branches 'tracing/ftrace', 'tracing/kmemtrace' and 'linus' into tracing/core

Ingo Molnar committed 17 years ago

Commit dc573f93 parents b3a8c34 ecf441b b1792e31490 files · +27283 −12277Browse files

Showing the changes to kernel/workqueue.c (1 of 1490 files). Show all

Unified · Split

kernel/workqueue.c+10−10
@@ -985,6 +985,8 @@ undo: · 984 unmodified lines
985985 }
986986
987987 #ifdef CONFIG_SMP
988+static struct workqueue_struct *work_on_cpu_wq __read_mostly;
989+
988990 struct work_for_cpu {
989991 struct work_struct work;
990992 long (*fn)(void *);
@@ -1005,8 +1007,8 @@ static void do_work_for_cpu(struct work_struct *w) · 14 unmodified lines
10051007 * @fn: the function to run
10061008 * @arg: the function arg
10071009 *
1008− * This will return -EINVAL in the cpu is not online, or the return value
1009− * of @fn otherwise.
1010+ * This will return the value @fn returns.
1011+ * It is up to the caller to ensure that the cpu doesn't go offline.
10101012 */
10111013 long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)
10121014 {
@@ -1015,14 +1017,8 @@ long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) · 2 unmodified lines
10151017 INIT_WORK(&wfc.work, do_work_for_cpu);
10161018 wfc.fn = fn;
10171019 wfc.arg = arg;
1018− get_online_cpus();
1019− if (unlikely(!cpu_online(cpu)))
1020− wfc.ret = -EINVAL;
1021− else {
1022− schedule_work_on(cpu, &wfc.work);
1023− flush_work(&wfc.work);
1024− }
1025− put_online_cpus();
1020+ queue_work_on(cpu, work_on_cpu_wq, &wfc.work);
1021+ flush_work(&wfc.work);
10261022
10271023 return wfc.ret;
10281024 }
@@ -1039,4 +1035,8 @@ void __init init_workqueues(void) · 10 unmodified lines
10391035 hotcpu_notifier(workqueue_cpu_callback, 0);
10401036 keventd_wq = create_workqueue("events");
10411037 BUG_ON(!keventd_wq);
1038+#ifdef CONFIG_SMP
1039+ work_on_cpu_wq = create_workqueue("work_on_cpu");
1040+ BUG_ON(!work_on_cpu_wq);
1041+#endif
10421042 }