From e5a9080784da8bb11c7dbcb87c2cf8986fbe5b3e Mon Sep 17 00:00:00 2001 From: Thomas Tuttle Date: Wed, 14 Sep 2011 16:22:28 -0700 Subject: [PATCH] --- yaml --- r: 263833 b: refs/heads/master c: fa2563e41c3d6d6e8af437643981ed28ae0cb56d h: refs/heads/master i: 263831: cb9693ea67c562e3acc18b24b4d1a044e4ab0aca v: v3 --- [refs] | 2 +- trunk/kernel/workqueue.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 4cb13e1bf88a..86a9ed7f780c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: df4e33ad249b7480d6ba5dd11fc1dac5cfaffce1 +refs/heads/master: fa2563e41c3d6d6e8af437643981ed28ae0cb56d diff --git a/trunk/kernel/workqueue.c b/trunk/kernel/workqueue.c index 25fb1b0e53fa..1783aabc6128 100644 --- a/trunk/kernel/workqueue.c +++ b/trunk/kernel/workqueue.c @@ -2412,8 +2412,13 @@ void drain_workqueue(struct workqueue_struct *wq) for_each_cwq_cpu(cpu, wq) { struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq); + bool drained; - if (!cwq->nr_active && list_empty(&cwq->delayed_works)) + spin_lock_irq(&cwq->gcwq->lock); + drained = !cwq->nr_active && list_empty(&cwq->delayed_works); + spin_unlock_irq(&cwq->gcwq->lock); + + if (drained) continue; if (++flush_cnt == 10 ||