Re: [PATCH v2] io_uring/lock: Keep spinlock release before wake_up()
From: Jens Axboe
Date: Wed Sep 23 2026 - 14:26:58 EST
On 9/23/26 10:16 AM, Xiaochuan Li wrote:
> @@ -574,9 +575,8 @@ static struct io_wq_work *io_get_next_work(struct io_wq_acct *acct,
> unstalled = io_wait_on_hash(wq, stall_hash);
> raw_spin_lock(&acct->lock);
> if (unstalled) {
> + *need_wake = true;
> clear_bit(IO_ACCT_STALLED_BIT, &acct->flags);
> - if (wq_has_sleeper(&wq->hash->wait))
> - wake_up(&wq->hash->wait);
> }
> }
*need_wake = wq_has_sleeper(&wq->hash->wait);
? And probably retain the sme ordering with the bit clear.
Apart from that, I think it looks fine. The lock shuffling is somewhat
annoying and inefficient, an unfortunate side effect of the raw vs
normal spinlocks.
--
Jens Axboe