summaryrefslogtreecommitdiff
path: root/Documentation/core-api
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2023-08-08 04:57:25 +0300
committerTejun Heo <tj@kernel.org>2023-08-08 04:57:25 +0300
commit0219a3528d72143d8d2c4c793b61541d03518b59 (patch)
tree275f19e2b3a844ef2092e44670122707d203b8b4 /Documentation/core-api
parent873eaca6eaf84b1d1ed5b7259308c6a4fca70fdc (diff)
downloadlinux-0219a3528d72143d8d2c4c793b61541d03518b59.tar.xz
workqueue: Factor out need_more_worker() check and worker wake-up
Checking need_more_worker() and calling wake_up_worker() is a repeated pattern. Let's add kick_pool(), which checks need_more_worker() and open-code wake_up_worker(), and replace wake_up_worker() uses. The following conversions aren't one-to-one: * __queue_work() was using __need_more_work() because it knows that pool->worklist isn't empty. Switching to kick_pool() adds an extra list_empty() test. * create_worker() always needs to wake up the newly minted worker whether there's more work to do or not to avoid triggering hung task check on the new task. Keep the current wake_up_process() and still add kick_pool(). This may lead to an extra wakeup which isn't harmful. * pwq_adjust_max_active() was explicitly checking whether it needs to wake up a worker or not to avoid spurious wakeups. As kick_pool() only wakes up a worker when necessary, this explicit check is no longer necessary and dropped. * unbind_workers() now calls kick_pool() instead of wake_up_worker() adding a need_more_worker() test. This avoids spurious wakeups and shouldn't break anything. wake_up_worker() is dropped as kick_pool() replaces all its users. After this patch, all paths that wakes up a non-rescuer worker to initiate work item execution use kick_pool(). This will enable future changes to improve locality. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'Documentation/core-api')
0 files changed, 0 insertions, 0 deletions