[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 09/10] aio: add .io_poll_begin/end() callback

From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v3 09/10] aio: add .io_poll_begin/end() callbacks
Date: Wed, 23 Nov 2016 11:59:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 23/11/2016 10:44, Stefan Hajnoczi wrote:
> I thought about the final poll but decided it was nicer for virtio.c to
> do it internally.  Not all .io_poll_end() implementations may require an
> additional poll so it seemed more optimal to leave it up to each
> callback.
> If you prefer the run_poll_handlers_once(ctx) approach I'll switch to
> that.

I think the question is more whether it makes sense to poll once even
for non-blocking aio_poll.  I think it does; after all, why even call
ppoll() if all sources support polling and you don't need to sleep? :)

Doing the run_poll_handlers_once automatically after .io_poll_end()
would be a side effect of how to write that code, but it's the less
interesting part.

BTW, iothread.c doesn't use non-blocking aio_poll, but there are
interesting opportunities for (micro)optimization of the event loop
involving non-blocking mode.  For example we could add a

    if (atomic_read(&ctx->notified)) {
        blocking = false;

at the beginning of aio_poll.  When a bottom half is scheduled, this
would avoid further notifications (notify_me stays zero) and skip
aio_compute_timeout.  I think it's worthwhile for aio=threads, but it
would be a pity to lose polling in this case.  The null backend also
uses bottom halves heavily, either directly for null-aio:// or through
bdrv_co_maybe_schedule_bh for null-co://.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]