On Thu, Jul 3, 2014 at 7:56 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: > Il 03/07/2014 13:50, Ming Lei ha scritto: > >>> Yes, you can just move the atomic_inc/atomic_dec in aio_poll. >> >> >> If you mean move inc/dec of 'running' in aio_poll, that won't work. >> When aio_notify() sees 'running', it won't set notifier, and may >> trap to ppoll(). > > > I mean move it to aio_poll, around the second invocation of aio_dispatch. > IIRC the first invocation of aio_dispatch is only used when AioContext is > running as a GSource. It should never run for dataplane, so it's okay if we > only trap aio_notify from the second aio_dispatch().
That is fine. > > In 2.2, we should rewrite aio_poll() to follow the > prepare/poll/check/dispatch model of glib. Then the optimization becomes > much simpler (you only call aio_dispatch once) and it also works for GSource > mode. > > Stefan convinced me to send the patch myself, so I will do it now. That is great, and virtio-blk multi vqs can benefit from this patch a lot, :-) Thanks, -- Ming Lei