Skip to content

Commit

Permalink
Merge branch 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/tj/wq

Pull workqueue update from Tejun Heo:
 "The same as the cgroup tree - one commit which was scheduled for the
  5.11 merge window.

  All the commit does is avoding spurious worker wakeups from workqueue
  allocation / config change path to help cpuisol use cases"

* 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
  workqueue: Kick a worker based on the actual activation of delayed works
  • Loading branch information
torvalds committed Dec 28, 2020
2 parents 91afe60 + 01341fb commit c76e02c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -3731,17 +3731,24 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq)
* is updated and visible.
*/
if (!freezable || !workqueue_freezing) {
bool kick = false;

pwq->max_active = wq->saved_max_active;

while (!list_empty(&pwq->delayed_works) &&
pwq->nr_active < pwq->max_active)
pwq->nr_active < pwq->max_active) {
pwq_activate_first_delayed(pwq);
kick = true;
}

/*
* Need to kick a worker after thawed or an unbound wq's
* max_active is bumped. It's a slow path. Do it always.
* max_active is bumped. In realtime scenarios, always kicking a
* worker will cause interference on the isolated cpu cores, so
* let's kick iff work items were activated.
*/
wake_up_worker(pwq->pool);
if (kick)
wake_up_worker(pwq->pool);
} else {
pwq->max_active = 0;
}
Expand Down

0 comments on commit c76e02c

Please sign in to comment.