public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_uring/io-wq: ensure workers are woken when io-wq context is exited
@ 2026-01-05 14:45 Jens Axboe
  2026-01-05 15:45 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2026-01-05 14:45 UTC (permalink / raw)
  To: io-uring

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.

Cc: stable@vger.kernel.org # v6.18+
Signed-off-by: Jens Axboe <axboe@kernel.dk>

---

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.

diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index cd13d8aac3d2..fd8c15ad2b97 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -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)

-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] io_uring/io-wq: ensure workers are woken when io-wq context is exited
  2026-01-05 14:45 [PATCH] io_uring/io-wq: ensure workers are woken when io-wq context is exited Jens Axboe
@ 2026-01-05 15:45 ` Jens Axboe
       [not found]   ` <CAAZOf259y2HOVrCaqMvvegowp9fFgZSx2hqeP=ZfHJ2D9GyUUg@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2026-01-05 15:45 UTC (permalink / raw)
  To: io-uring; +Cc: Max Kellermann

On 1/5/26 7:45 AM, Jens Axboe wrote:
> 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.
> 
> Cc: stable@vger.kernel.org # v6.18+
> Signed-off-by: Jens Axboe <axboe@kernel.dk>

Fixes: 751eedc4b4b7 ("io_uring/io-wq: move worker lists to struct io_wq_acct")

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] io_uring/io-wq: ensure workers are woken when io-wq context is exited
       [not found]   ` <CAAZOf259y2HOVrCaqMvvegowp9fFgZSx2hqeP=ZfHJ2D9GyUUg@mail.gmail.com>
@ 2026-01-05 15:54     ` Jens Axboe
       [not found]       ` <CAAZOf25R3eg0YzyWAyT0hhqe-mngcESKrweoyVcuR6n+7L1Usg@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2026-01-05 15:54 UTC (permalink / raw)
  To: David Kahurani; +Cc: io-uring, Max Kellermann

On 1/5/26 8:55 AM, David Kahurani wrote:
> 
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] io_uring/io-wq: ensure workers are woken when io-wq context is exited
       [not found]       ` <CAAZOf25R3eg0YzyWAyT0hhqe-mngcESKrweoyVcuR6n+7L1Usg@mail.gmail.com>
@ 2026-01-05 17:59         ` David Kahurani
  0 siblings, 0 replies; 4+ messages in thread
From: David Kahurani @ 2026-01-05 17:59 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Max Kellermann

Wire that up!

On Mon, Jan 5, 2026 at 8:52 PM David Kahurani <k.kahurani@gmail.com> wrote:
>
> In what case I will,....
>
> Assume a legal protocol.
>
> On Mon, Jan 5, 2026 at 6:54 PM Jens Axboe <axboe@kernel.dk> wrote:
>>
>> On 1/5/26 8:55 AM, David Kahurani wrote:
>> >
>> > 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
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-05 17:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 14:45 [PATCH] io_uring/io-wq: ensure workers are woken when io-wq context is exited Jens Axboe
2026-01-05 15:45 ` Jens Axboe
     [not found]   ` <CAAZOf259y2HOVrCaqMvvegowp9fFgZSx2hqeP=ZfHJ2D9GyUUg@mail.gmail.com>
2026-01-05 15:54     ` Jens Axboe
     [not found]       ` <CAAZOf25R3eg0YzyWAyT0hhqe-mngcESKrweoyVcuR6n+7L1Usg@mail.gmail.com>
2026-01-05 17:59         ` David Kahurani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox