diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2013-03-20 13:52:30 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-03-20 13:52:30 -0400 |
commit | 951a078a5285ad31bc22e190616ad54b78fac992 (patch) | |
tree | 0718bffc99fd05a49f1a3ce86cd01a99e5661c14 /kernel/workqueue.c | |
parent | 6a092dfd51e5af9b321d683d4b4eddc79e2606ed (diff) |
workqueue: kick a worker in pwq_adjust_max_active()
If pwq_adjust_max_active() changes max_active from 0 to
saved_max_active, it needs to wakeup worker. This is already done by
thaw_workqueues().
If pwq_adjust_max_active() increases max_active for an unbound wq,
while not strictly necessary for correctness, it's still desirable to
wake up a worker so that the requested concurrency level is reached
sooner.
Move wake_up_worker() call from thaw_workqueues() to
pwq_adjust_max_active() so that it can handle both of the above two
cases. This also makes thaw_workqueues() simpler.
tj: Updated comments and description.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index d2ac6cbfe8ab..79d1d347e690 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -3598,6 +3598,12 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq) | |||
3598 | while (!list_empty(&pwq->delayed_works) && | 3598 | while (!list_empty(&pwq->delayed_works) && |
3599 | pwq->nr_active < pwq->max_active) | 3599 | pwq->nr_active < pwq->max_active) |
3600 | pwq_activate_first_delayed(pwq); | 3600 | pwq_activate_first_delayed(pwq); |
3601 | |||
3602 | /* | ||
3603 | * Need to kick a worker after thawed or an unbound wq's | ||
3604 | * max_active is bumped. It's a slow path. Do it always. | ||
3605 | */ | ||
3606 | wake_up_worker(pwq->pool); | ||
3601 | } else { | 3607 | } else { |
3602 | pwq->max_active = 0; | 3608 | pwq->max_active = 0; |
3603 | } | 3609 | } |
@@ -4401,13 +4407,6 @@ void thaw_workqueues(void) | |||
4401 | } | 4407 | } |
4402 | spin_unlock_irq(&pwq_lock); | 4408 | spin_unlock_irq(&pwq_lock); |
4403 | 4409 | ||
4404 | /* kick workers */ | ||
4405 | for_each_pool(pool, pi) { | ||
4406 | spin_lock_irq(&pool->lock); | ||
4407 | wake_up_worker(pool); | ||
4408 | spin_unlock_irq(&pool->lock); | ||
4409 | } | ||
4410 | |||
4411 | workqueue_freezing = false; | 4410 | workqueue_freezing = false; |
4412 | out_unlock: | 4411 | out_unlock: |
4413 | mutex_unlock(&wq_mutex); | 4412 | mutex_unlock(&wq_mutex); |