aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-07-30 01:33:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-30 12:41:47 -0400
commit6af8bf3d86d55c98af6e453cb920ddc30867e5c7 (patch)
treea82494403b76591082a2dc391da3136c6674b356 /kernel/workqueue.c
parentdbacefc9c4f6bd365243db379473ab7041656d90 (diff)
workqueues: add comments to __create_workqueue_key()
Dmitry Adamushko pointed out that the error handling in __create_workqueue_key() is not clear, add the comment. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Dmitry Adamushko <dmitry.adamushko@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ec7e4f62aaff..4a26a1382df0 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -830,10 +830,21 @@ struct workqueue_struct *__create_workqueue_key(const char *name,
830 start_workqueue_thread(cwq, -1); 830 start_workqueue_thread(cwq, -1);
831 } else { 831 } else {
832 cpu_maps_update_begin(); 832 cpu_maps_update_begin();
833 /*
834 * We must place this wq on list even if the code below fails.
835 * cpu_down(cpu) can remove cpu from cpu_populated_map before
836 * destroy_workqueue() takes the lock, in that case we leak
837 * cwq[cpu]->thread.
838 */
833 spin_lock(&workqueue_lock); 839 spin_lock(&workqueue_lock);
834 list_add(&wq->list, &workqueues); 840 list_add(&wq->list, &workqueues);
835 spin_unlock(&workqueue_lock); 841 spin_unlock(&workqueue_lock);
836 842 /*
843 * We must initialize cwqs for each possible cpu even if we
844 * are going to call destroy_workqueue() finally. Otherwise
845 * cpu_up() can hit the uninitialized cwq once we drop the
846 * lock.
847 */
837 for_each_possible_cpu(cpu) { 848 for_each_possible_cpu(cpu) {
838 cwq = init_cpu_workqueue(wq, cpu); 849 cwq = init_cpu_workqueue(wq, cpu);
839 if (err || !cpu_online(cpu)) 850 if (err || !cpu_online(cpu))