Re: [PATCH v2 4/4] workqueue: defer the worker wakeup outside pool->lock in process_one_work()
From: Tejun Heo
Date: Thu Jun 04 2026 - 05:03:49 EST
On Wed, Jun 03, 2026 at 06:40:11AM -0700, Breno Leitao wrote:
> process_one_work() kicks the pool to chain execution of the remaining
> work items on WORKER_NOT_RUNNING pools (the UNBOUND and CPU_INTENSIVE
> ones), calling kick_pool() while holding pool->lock. As in the enqueue
> path, the wakeup pulls the target rq->lock in under pool->lock.
>
> Use kick_pool_pick() to select and claim the worker under pool->lock and
> issue the wakeup with wake_up_q() after the lock is dropped via
> raw_spin_unlock_irq_wake().
>
> With both hot paths converted, measured on a CONFIG_SMP x86 VM (8 vCPUs)
> with the in-tree test_workqueue benchmark (lib/test_workqueue.c; each of
> 8 producers queues 200000 work items one at a time on a WQ_UNBOUND
> workqueue, waiting for each to complete), medians of five boots per
> scope:
Please test on bare metal.
Thanks.
--
tejun