aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/workqueue.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 1935302cc645..58e5c152a6bb 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -752,18 +752,17 @@ static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
752 if (cwq->thread == NULL) 752 if (cwq->thread == NULL)
753 return; 753 return;
754 754
755 flush_cpu_workqueue(cwq);
755 /* 756 /*
756 * If the caller is CPU_DEAD the single flush_cpu_workqueue() 757 * If the caller is CPU_DEAD and cwq->worklist was not empty,
757 * is not enough, a concurrent flush_workqueue() can insert a 758 * a concurrent flush_workqueue() can insert a barrier after us.
758 * barrier after us. 759 * However, in that case run_workqueue() won't return and check
760 * kthread_should_stop() until it flushes all work_struct's.
759 * When ->worklist becomes empty it is safe to exit because no 761 * When ->worklist becomes empty it is safe to exit because no
760 * more work_structs can be queued on this cwq: flush_workqueue 762 * more work_structs can be queued on this cwq: flush_workqueue
761 * checks list_empty(), and a "normal" queue_work() can't use 763 * checks list_empty(), and a "normal" queue_work() can't use
762 * a dead CPU. 764 * a dead CPU.
763 */ 765 */
764 while (flush_cpu_workqueue(cwq))
765 ;
766
767 kthread_stop(cwq->thread); 766 kthread_stop(cwq->thread);
768 cwq->thread = NULL; 767 cwq->thread = NULL;
769} 768}