Skip to content

Commit 9bfb183

Browse files
Ingo MolnarLinus Torvalds
authored andcommitted
[PATCH] workqueue: fix schedule_on_each_cpu()
fix the schedule_on_each_cpu() implementation: __queue_work() is now stricter, hence set the work-pending bit before passing in the new work. (found in the -rt tree, using Peter Zijlstra's files-lock scalability patchset) Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 5ccac88 commit 9bfb183

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

kernel/workqueue.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,11 @@ int schedule_on_each_cpu(work_func_t func)
637637

638638
mutex_lock(&workqueue_mutex);
639639
for_each_online_cpu(cpu) {
640-
INIT_WORK(per_cpu_ptr(works, cpu), func);
641-
__queue_work(per_cpu_ptr(keventd_wq->cpu_wq, cpu),
642-
per_cpu_ptr(works, cpu));
640+
struct work_struct *work = per_cpu_ptr(works, cpu);
641+
642+
INIT_WORK(work, func);
643+
set_bit(WORK_STRUCT_PENDING, work_data_bits(work));
644+
__queue_work(per_cpu_ptr(keventd_wq->cpu_wq, cpu), work);
643645
}
644646
mutex_unlock(&workqueue_mutex);
645647
flush_workqueue(keventd_wq);

0 commit comments

Comments
 (0)