]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
workqueue: Provide a handshake for canceling BH workers
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 4 Sep 2025 14:25:23 +0000 (16:25 +0200)
committerTejun Heo <tj@kernel.org>
Thu, 4 Sep 2025 17:28:33 +0000 (07:28 -1000)
commitad7c7f4b9c6c2950778e5bd305392a333de73912
treedcd65102da77a7460dbf8e328f048eda467c6997
parentcda2b2d647f7e467e53655b56ff430732fb1fa17
workqueue: Provide a handshake for canceling BH workers

While a BH work item is canceled, the core code spins until it
determines that the item completed. On PREEMPT_RT the spinning relies on
a lock in local_bh_disable() to avoid a live lock if the canceling
thread has higher priority than the BH-worker and preempts it. This lock
ensures that the BH-worker makes progress by PI-boosting it.

This lock in local_bh_disable() is a central per-CPU BKL and about to be
removed.

To provide the required synchronisation add a per pool lock. The lock is
acquired by the bh_worker at the begin while the individual callbacks
are invoked. To enforce progress in case of interruption, __flush_work()
needs to acquire the lock.
This will flush all BH-work items assigned to that pool.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c