From c62111e4e28f17b92c68979e8a9887c8a48d16d6 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Tue, 17 Jul 2007 04:03:55 -0700 Subject: [PATCH] --- yaml --- r: 60773 b: refs/heads/master c: 13c22168b7276dffe49dc66675d5a78f6d288e0d h: refs/heads/master i: 60771: 91a463b5c72d27b0e5f7ee23c86579955bb9235d v: v3 --- [refs] | 2 +- trunk/kernel/workqueue.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 67e7c60766e0..f5d7fe8e4200 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 87a7defb0d4255d5aea2c5067813b26836127983 +refs/heads/master: 13c22168b7276dffe49dc66675d5a78f6d288e0d diff --git a/trunk/kernel/workqueue.c b/trunk/kernel/workqueue.c index 1935302cc645..58e5c152a6bb 100644 --- a/trunk/kernel/workqueue.c +++ b/trunk/kernel/workqueue.c @@ -752,18 +752,17 @@ static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) if (cwq->thread == NULL) return; + flush_cpu_workqueue(cwq); /* - * If the caller is CPU_DEAD the single flush_cpu_workqueue() - * is not enough, a concurrent flush_workqueue() can insert a - * barrier after us. + * If the caller is CPU_DEAD and cwq->worklist was not empty, + * a concurrent flush_workqueue() can insert a barrier after us. + * However, in that case run_workqueue() won't return and check + * kthread_should_stop() until it flushes all work_struct's. * When ->worklist becomes empty it is safe to exit because no * more work_structs can be queued on this cwq: flush_workqueue * checks list_empty(), and a "normal" queue_work() can't use * a dead CPU. */ - while (flush_cpu_workqueue(cwq)) - ; - kthread_stop(cwq->thread); cwq->thread = NULL; }