OSDN Git Service

aio-posix: remove idle poll handlers to improve scalability
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 5 Mar 2020 17:08:06 +0000 (17:08 +0000)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 9 Mar 2020 16:45:16 +0000 (16:45 +0000)
commitd37d0e365afb6825a90d8356fc6adcc1f58f40f3
treed5cc874fc5fffaaecd073a4f56dac12378449265
parentaa38e19f05c3a5ae64dff84f44e1aa31281a5b14
aio-posix: remove idle poll handlers to improve scalability

When there are many poll handlers it's likely that some of them are idle
most of the time.  Remove handlers that haven't had activity recently so
that the polling loop scales better for guests with a large number of
devices.

This feature only takes effect for the Linux io_uring fd monitoring
implementation because it is capable of combining fd monitoring with
userspace polling.  The other implementations can't do that and risk
starving fds in favor of poll handlers, so don't try this optimization
when they are in use.

IOPS improves from 10k to 105k when the guest has 100
virtio-blk-pci,num-queues=32 devices and 1 virtio-blk-pci,num-queues=1
device for rw=randread,iodepth=1,bs=4k,ioengine=libaio on NVMe.

[Clarified aio_poll_handlers locking discipline explanation in comment
after discussion with Paolo Bonzini <pbonzini@redhat.com>.
--Stefan]

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Link: https://lore.kernel.org/r/20200305170806.1313245-8-stefanha@redhat.com
Message-Id: <20200305170806.1313245-8-stefanha@redhat.com>
include/block/aio.h
util/aio-posix.c
util/aio-posix.h
util/trace-events