__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: 7e84e1c7566a ("io_uring: allow disabling rings during the creation") Assisted-by: LLM Signed-off-by: Josef Bacik --- io_uring/sqpoll.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/io_uring/sqpoll.c b/io_uring/sqpoll.c index ad42e8eb1002..ee97808a065a 100644 --- a/io_uring/sqpoll.c +++ b/io_uring/sqpoll.c @@ -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; -- 2.55.0