summaryrefslogtreecommitdiff
path: root/util/aio-posix.h
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2020-03-05 17:08:06 +0000
committerStefan Hajnoczi <stefanha@redhat.com>2020-03-09 16:45:16 +0000
commitd37d0e365afb6825a90d8356fc6adcc1f58f40f3 (patch)
treed5cc874fc5fffaaecd073a4f56dac12378449265 /util/aio-posix.h
parentaa38e19f05c3a5ae64dff84f44e1aa31281a5b14 (diff)
downloadqemu-d37d0e365afb6825a90d8356fc6adcc1f58f40f3.zip
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 'util/aio-posix.h')
-rw-r--r--util/aio-posix.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/aio-posix.h b/util/aio-posix.h
index 55fc771327..c80c04506a 100644
--- a/util/aio-posix.h
+++ b/util/aio-posix.h
@@ -30,10 +30,12 @@ struct AioHandler {
QLIST_ENTRY(AioHandler) node;
QLIST_ENTRY(AioHandler) node_ready; /* only used during aio_poll() */
QLIST_ENTRY(AioHandler) node_deleted;
+ QLIST_ENTRY(AioHandler) node_poll;
#ifdef CONFIG_LINUX_IO_URING
QSLIST_ENTRY(AioHandler) node_submitted;
unsigned flags; /* see fdmon-io_uring.c */
#endif
+ int64_t poll_idle_timeout; /* when to stop userspace polling */
bool is_external;
};