On 04/06/2016 00:26, Stefan Hajnoczi wrote: > It turns out that Patch 1 slows down dataplane even though the code > looks equivalent. After a lot of poking it turned out to be a subtle > issue: > > The order of BHs in the AioContext->first_bh list affects performance. > Linux AIO (block/linux-aio.c) invokes completion callbacks from a BH. > Performance is much better if virtio-blk.c's batch BH is after the > completion BH. > > The "fast" ordering notifies the guest in ~300 nanoseconds after the > last request completion. > > The "slow" ordering sometimes takes 100 microseconds after the last > request completion before the guest is notified. It probably depends on > whether the event loop is kicked by another source. > > I'm thinking of scrapping the batch BH and instead using a notify > plug/unplug callback to suppress notification until the last request has > been processed. > > I also checked that batch notification does indeed improve performance > compared to no batching. It offers a nice boost so we do want to port > the feature from dataplane to non-dataplane. > > For the time being: consider this patch series broken due to the > performance regression.
Thanks for the nice analysis! Paolo