summaryrefslogtreecommitdiffstats
path: root/include/block/aio.h
diff options
context:
space:
mode:
authorFam Zheng2015-10-30 05:06:29 +0100
committerStefan Hajnoczi2015-11-09 10:59:47 +0100
commitfbe3fc5cb3cd9f9064e98c549684e821c353fe41 (patch)
tree8a43f761c73026ab222b1793e81cc8596cb217c4 /include/block/aio.h
parentaio: Introduce aio_context_setup (diff)
downloadqemu-fbe3fc5cb3cd9f9064e98c549684e821c353fe41.tar.gz
qemu-fbe3fc5cb3cd9f9064e98c549684e821c353fe41.tar.xz
qemu-fbe3fc5cb3cd9f9064e98c549684e821c353fe41.zip
aio: Introduce aio-epoll.c
To minimize code duplication, epoll is hooked into aio-posix's aio_poll() instead of rolling its own. This approach also has both compile-time and run-time switchability. 1) When QEMU starts with a small number of fds in the event loop, ppoll is used. 2) When QEMU starts with a big number of fds, or when more devices are hot plugged, epoll kicks in when the number of fds hits the threshold. 3) Some fds may not support epoll, such as tty based stdio. In this case, it falls back to ppoll. A rough benchmark with scsi-disk on virtio-scsi dataplane (epoll gets enabled from 64 onward). Numbers are in MB/s. =============================================== | master | epoll | | scsi disks # | read randrw | read randrw -------------|----------------|---------------- 1 | 86 36 | 92 45 8 | 87 43 | 86 41 64 | 71 32 | 70 38 128 | 48 24 | 58 31 256 | 37 19 | 57 28 =============================================== To comply with aio_{disable,enable}_external, we always use ppoll when aio_external_disabled() is true. [Removed #ifdef CONFIG_EPOLL around AioContext epollfd field declaration since the field is also referenced outside CONFIG_EPOLL code. --Stefan] Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1446177989-6702-4-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include/block/aio.h')
-rw-r--r--include/block/aio.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/block/aio.h b/include/block/aio.h
index 9ffecf7977..e086e3b4ee 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -124,6 +124,11 @@ struct AioContext {
QEMUTimerListGroup tlg;
int external_disable_cnt;
+
+ /* epoll(7) state used when built with CONFIG_EPOLL */
+ int epollfd;
+ bool epoll_enabled;
+ bool epoll_available;
};
/**