Commit cfeb35d6 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Fam Zheng
Browse files

aio-posix: do skip system call if ctx->notifier polling succeeds



Commit 70232b52 ("aio-posix: Don't count ctx->notifier as progress when
2018-08-15), by not reporting progress, causes aio_poll to execute the
system call when polling succeeds because of ctx->notifier.  This introduces
latency before the call to aio_bh_poll() and negates the advantages of
polling, unfortunately.

The fix builds on the previous patch, separating the effect of polling on
the timeout from the progress reported to aio_poll().  ctx->notifier
does zero the timeout, causing the caller to skip the system call,
but it does not report progress, so that the bug fix of commit 70232b52
still stands.

Fixes: 70232b52
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Message-Id: <20180912171040.1732-4-pbonzini@redhat.com>
Reviewed-by: default avatarFam Zheng <famz@redhat.com>
Signed-off-by: default avatarFam Zheng <famz@redhat.com>
parent e30cffa0
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -498,11 +498,12 @@ static bool run_poll_handlers_once(AioContext *ctx, int64_t *timeout)
    QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
        if (!node->deleted && node->io_poll &&
            aio_node_check(ctx, node->is_external) &&
            node->io_poll(node->opaque) &&
            node->opaque != &ctx->notifier) {
            node->io_poll(node->opaque)) {
            *timeout = 0;
            if (node->opaque != &ctx->notifier) {
                progress = true;
            }
        }

        /* Caller handles freeing deleted nodes.  Don't do it here. */
    }