diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2020-03-05 17:08:06 +0000 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2020-03-09 16:45:16 +0000 |
commit | d37d0e365afb6825a90d8356fc6adcc1f58f40f3 (patch) | |
tree | d5cc874fc5fffaaecd073a4f56dac12378449265 /include/block | |
parent | aa38e19f05c3a5ae64dff84f44e1aa31281a5b14 (diff) | |
download | qemu-d37d0e365afb6825a90d8356fc6adcc1f58f40f3.zip qemu-d37d0e365afb6825a90d8356fc6adcc1f58f40f3.tar.gz qemu-d37d0e365afb6825a90d8356fc6adcc1f58f40f3.tar.bz2 |
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>
Diffstat (limited to 'include/block')
-rw-r--r-- | include/block/aio.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/block/aio.h b/include/block/aio.h index f07ebb7..cb19891 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -227,6 +227,14 @@ struct AioContext { int64_t poll_grow; /* polling time growth factor */ int64_t poll_shrink; /* polling time shrink factor */ + /* + * List of handlers participating in userspace polling. Protected by + * ctx->list_lock. Iterated and modified mostly by the event loop thread + * from aio_poll() with ctx->list_lock incremented. aio_set_fd_handler() + * only touches the list to delete nodes if ctx->list_lock's count is zero. + */ + AioHandlerList poll_aio_handlers; + /* Are we in polling mode or monitoring file descriptors? */ bool poll_started; |