Re: [PATCH] io_uring: don't sleep on a claimed DEFER_TASKRUN wakeup

From: Daniel Byrne

Date: Wed Oct 28 2026 - 09:42:33 EST


On Mon, 19 Oct 2026 13:05:07 -0600, Jens Axboe wrote:
> This should already be fixed by proper ordering in my
> for-7.4/io_uring branch - see:
>
> 8257f6ec45ee ("io_uring: don't lose the DEFER_TASKRUN wake up")
>
> and
>
> 76a82c666abf ("io_uring/cancel: rearm local work wake up before sleep")
>
> Please take a look and see if you agree.

Yes, those two fix it. Setting the state before the count is
published removes the window my patch detected, and the re-arm after
prepare_to_wait() closes the cancel path the same way.

My prototype that found this polls DMA device completions in
TASK_RUNNING between the arm and the sleep. I added a test udelay(100)
in every 64th io_req_local_work_add() between the mpscq push and
the cq_wait_nr claim. As a result, we hit the race on v7.3.
On for-7.4/io_uring, re-arming through io_cq_wait_arm() after its poll,
we ran race free.

Thanks,

Daniel