Commit 816a430c517e ("util/aio: Defer disabling poll mode as long as possible") kept polling enabled when the event loop timeout is 0. Since there is no timeout the event loop will continue immediately and the overhead of disabling and re-enabling polling can be avoided.
fdmon-io_uring.c is unable to take advantage of this optimization because its ->need_wait() function returns true whenever there are new io_uring SQEs to submit: if (timeout || ctx->fdmon_ops->need_wait(ctx)) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Polling will be disabled even when timeout == 0. Extend the optimization to handle the case when need_wait() returns true and timeout == 0. Cc: Chao Gao <chao....@intel.com> Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> --- util/aio-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/aio-posix.c b/util/aio-posix.c index 2e0a5dadc4..2439cf0feb 100644 --- a/util/aio-posix.c +++ b/util/aio-posix.c @@ -722,7 +722,7 @@ bool aio_poll(AioContext *ctx, bool blocking) * up IO threads when some work becomes pending. It is essential to * avoid hangs or unnecessary latency. */ - if (poll_set_started(ctx, &ready_list, false)) { + if (timeout && poll_set_started(ctx, &ready_list, false)) { timeout = 0; progress = true; } -- 2.49.0