io_uring/io-wq: ensure workers are woken when io-wq context is exited
Jens Axboe
maintainerPATCH 1/1 io_uring/io-wq: ensure workers are woken when io-wq context is exited
When io_wq_exit_start() is called, the IO_WQ_BIT_EXIT bit is set to indicate to workers that the async context is going away. When that happens, any worker alive should be woken up. If that doesn't happen, then io-wq worker exit may take as long as WORKER_IDLE_TIMEOUT, which is set to 5 seconds by default.
---
Didn't fully bisect where this problem got introduced, it's sometime between 6.12 and 6.15. But as 6.18 is the latest maintained stable that has the issue, just mark it for 6.18.
io_uring/io-wq.c +8 -0
@@ -1294,6 +1294,14 @@ static bool io_task_work_match(struct callback_head *cb, void *data)void io_wq_exit_start (struct io_wq *wq) {set_bit (IO_WQ_BIT_EXIT , &wq->state); + +for (int i =0 ; i <IO_WQ_ACCT_NR ; i++) { +struct io_wq_acct *acct = &wq->acct[i]; + +raw_spin_lock (&acct->workers_lock); +io_acct_for_each_worker (acct, io_wq_worker_wake,NULL ); +raw_spin_unlock (&acct->workers_lock); + } }static void io_wq_cancel_tw_create (struct io_wq *wq)
Signature · 1 line
Jens Axboe
Jens Axboe
maintainerQuoted 8 lines · Jens Axboe
When
io_wq_exit_start()is called, theIO_WQ_BIT_EXITbit is set to indicate to workers that the async context is going away. When that happens, any worker alive should be woken up. If that doesn't happen, then io-wq worker exit may take as long asWORKER_IDLE_TIMEOUT, which is set to 5 seconds by default.Cc [email protected] # v6.18+Signed-off-by Jens Axboe <[email protected]>
Signature · 1 line
Jens Axboe
A message that is not in the archive (sent off-list or not yet received): CAAZOf259y2HOVrCaqMvvegowp9fFgZSx2hqeP=ZfHJ2D9GyUUg@mail.gmail.com
Jens Axboe
maintainerQuoted 2 lines · David Kahurani
work-queue has a bug but I don't know who to report to.
Ok that's enough of your random and useless emails. Welcome to the block list. Though that just solves the problem for me, please just go away and stop responding to list emails all together or I'll get you blocked from lore as well.
Signature · 1 line
Jens Axboe
A message that is not in the archive (sent off-list or not yet received): CAAZOf25R3eg0YzyWAyT0hhqe-mngcESKrweoyVcuR6n+7L1Usg@mail.gmail.com
Wire that up!
Quoted 19 lines · David Kahurani
In what case I will,....
Assume a legal protocol.
Quoted 13 lines · Jens Axboe
Quoted 2 lines · David Kahurani
work-queue has a bug but I don't know who to report to.
Ok that's enough of your random and useless emails. Welcome to the block list. Though that just solves the problem for me, please just go away and stop responding to list emails all together or I'll get you blocked from lore as well.
--
Jens Axboe