mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
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>
This commit is contained in:
parent
6a092dfd51
commit
951a078a52
@ -3598,6 +3598,12 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq)
|
||||
while (!list_empty(&pwq->delayed_works) &&
|
||||
pwq->nr_active < pwq->max_active)
|
||||
pwq_activate_first_delayed(pwq);
|
||||
|
||||
/*
|
||||
* Need to kick a worker after thawed or an unbound wq's
|
||||
* max_active is bumped. It's a slow path. Do it always.
|
||||
*/
|
||||
wake_up_worker(pwq->pool);
|
||||
} else {
|
||||
pwq->max_active = 0;
|
||||
}
|
||||
@ -4401,13 +4407,6 @@ void thaw_workqueues(void)
|
||||
}
|
||||
spin_unlock_irq(&pwq_lock);
|
||||
|
||||
/* kick workers */
|
||||
for_each_pool(pool, pi) {
|
||||
spin_lock_irq(&pool->lock);
|
||||
wake_up_worker(pool);
|
||||
spin_unlock_irq(&pool->lock);
|
||||
}
|
||||
|
||||
workqueue_freezing = false;
|
||||
out_unlock:
|
||||
mutex_unlock(&wq_mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user