]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/commitdiff
workqueue: use cwq_set_max_active() helper for workqueue_set_max_active()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Wed, 19 Sep 2012 17:40:48 +0000 (10:40 -0700)
committerTejun Heo <tj@kernel.org>
Wed, 19 Sep 2012 17:40:48 +0000 (10:40 -0700)
workqueue_set_max_active() may increase ->max_active without
activating delayed works and may make the activation order differ from
the queueing order.  Both aren't strictly bugs but the resulting
behavior could be a bit odd.

To make things more consistent, use cwq_set_max_active() helper which
immediately makes use of the newly increased max_mactive if there are
delayed work items and also keeps the activation order.

tj: Slight update to description.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c

index b5d722548ffd1c16c041c0ba3d1a42557756ae11..4f5c61f8b0e7c548768a1eb85b0b3d7841720f3c 100644 (file)
@@ -3413,7 +3413,7 @@ void workqueue_set_max_active(struct workqueue_struct *wq, int max_active)
 
                if (!(wq->flags & WQ_FREEZABLE) ||
                    !(gcwq->flags & GCWQ_FREEZING))
-                       get_cwq(gcwq->cpu, wq)->max_active = max_active;
+                       cwq_set_max_active(get_cwq(gcwq->cpu, wq), max_active);
 
                spin_unlock_irq(&gcwq->lock);
        }