Re: [PATCH 2/2] workqueue: defer wake_up_process() outside pool->lock on hot paths

From: Hillf Danton

Date: Tue May 26 2026 - 17:25:00 EST


On Tue, 26 May 2026 14:08:06 -0400 Breno Leitao wrote:
> @@ -2423,6 +2424,15 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
>
> out:
> raw_spin_unlock(&pool->lock);
> + /*
> + * Issue the wakeup after dropping pool->lock to shorten the
> + * locked region on this hot enqueue path. kick_pool_pick() did all
> + * of the work that required the lock (worker selection and
> + * wake_cpu setup); the wake_up_process() itself only needs to
> + * take the target rq->lock.
> + */
> + if (wake_p)
> + wake_up_process(wake_p);
> rcu_read_unlock();
> }
>
I suspect this works without the pool lock held, go and see workers culled
in idle_cull_fn() for example.