mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:56:38 +00:00
aio-poll: avoid unnecessary polling time computation
Nodes are no longer added to poll_aio_handlers when adaptive polling is disabled, preventing unnecessary try_poll_mode() calls. This avoids iterating over all nodes to compute max_ns unnecessarily when polling is disabled. Signed-off-by: Jaehoon Kim <jhkim@linux.ibm.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-ID: <20260423195918.661299-2-jhkim@linux.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
committed by
Stefan Hajnoczi
parent
759c456b1d
commit
ed21d9d65c
@@ -307,9 +307,8 @@ static bool aio_dispatch_handler(AioContext *ctx, AioHandler *node)
|
||||
* fdmon_supports_polling(), but only until the fd fires for the first
|
||||
* time.
|
||||
*/
|
||||
if (!QLIST_IS_INSERTED(node, node_deleted) &&
|
||||
!QLIST_IS_INSERTED(node, node_poll) &&
|
||||
node->io_poll) {
|
||||
if (ctx->poll_max_ns && !QLIST_IS_INSERTED(node, node_deleted) &&
|
||||
!QLIST_IS_INSERTED(node, node_poll) && node->io_poll) {
|
||||
trace_poll_add(ctx, node, node->pfd.fd, revents);
|
||||
if (ctx->poll_started && node->io_poll_begin) {
|
||||
node->io_poll_begin(node->opaque);
|
||||
@@ -631,7 +630,7 @@ static void adjust_polling_time(AioContext *ctx, AioPolledEvent *poll,
|
||||
bool aio_poll(AioContext *ctx, bool blocking)
|
||||
{
|
||||
AioHandlerList ready_list = QLIST_HEAD_INITIALIZER(ready_list);
|
||||
bool progress;
|
||||
bool progress = false;
|
||||
bool use_notify_me;
|
||||
int64_t timeout;
|
||||
int64_t start = 0;
|
||||
@@ -656,7 +655,9 @@ bool aio_poll(AioContext *ctx, bool blocking)
|
||||
}
|
||||
|
||||
timeout = blocking ? aio_compute_timeout(ctx) : 0;
|
||||
progress = try_poll_mode(ctx, &ready_list, &timeout);
|
||||
if (ctx->poll_max_ns != 0) {
|
||||
progress = try_poll_mode(ctx, &ready_list, &timeout);
|
||||
}
|
||||
assert(!(timeout && progress));
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user