Re: [PATCH v2] rhashtable: Bounce deferred worker kick through irq_work

From: Herbert Xu

Date: Mon Apr 20 2026 - 23:02:37 EST


On Mon, Apr 20, 2026 at 08:12:58AM -1000, Tejun Heo wrote:
> Inserts past 75% load call schedule_work(&ht->run_work) to kick an
> async resize. If a caller holds a raw spinlock (e.g. an
> insecure_elasticity user), schedule_work() under that lock records
>
> caller_lock -> pool->lock -> pi_lock -> rq->__lock
>
> A cycle forms if any of these locks is acquired in the reverse
> direction elsewhere. sched_ext, the only current insecure_elasticity
> user, hits this: it holds scx_sched_lock across rhashtable inserts of
> sub-schedulers, while scx_bypass() takes rq->__lock -> scx_sched_lock.
> Exercising the resize path produces:
>
> Chain exists of:
> &pool->lock --> &rq->__lock --> scx_sched_lock
>
> Route the kick unconditionally through irq_work so schedule_work() runs
> from hard IRQ context with the caller's lock no longer held.
>
> v2: bounce unconditionally instead of gating on insecure_elasticity, as
> suggested by Herbert.
>
> Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
> ---
> Herbert, any preference on how this should be routed?

Acked-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Please feel free to take this through your tree.

Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt