mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
io_uring/sqpoll: let the thread sleep on disabled rings
__io_sq_thread() doesn't submit anything as long as the ring has
IORING_SETUP_R_DISABLED set. The check that keeps the SQPOLL thread from
going to sleep while the SQ ring holds entries doesn't know about that.
If an application fills in SQEs first and enables the ring later, the
thread finds that there is work each time it is about to sleep, goes
around, doesn't submit it, and so on. It uses up a CPU until the ring
gets enabled.
Entries in the SQ ring of a disabled ring are no reason to stay awake.
io_register_enable_rings() clears the flag and then wakes the thread, and
the flag is looked at after prepare_to_wait(), so the thread can't miss
that.
Fixes: 0298ef969a ("io_uring: clean R_DISABLED startup mess")
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Link: https://patch.msgid.link/20261015-b4-io-uring-fixes-v1-37-c1556f5d7bf5@toxicpanda.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
6e773b5161
commit
d492dcbb3b
|
|
@ -385,6 +385,13 @@ static int io_sq_thread(void *data)
|
|||
*/
|
||||
smp_mb__after_atomic();
|
||||
|
||||
/*
|
||||
* Nothing gets submitted before the ring is
|
||||
* enabled, which comes with a wake up.
|
||||
*/
|
||||
if (READ_ONCE(ctx->flags) & IORING_SETUP_R_DISABLED)
|
||||
continue;
|
||||
|
||||
if (io_sqring_entries(ctx)) {
|
||||
needs_sched = false;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user