]> git.proxmox.com Git - mirror_qemu.git/commit - util/aio-posix.c
aio: Introduce aio-epoll.c
authorFam Zheng <famz@redhat.com>
Fri, 30 Oct 2015 04:06:29 +0000 (12:06 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 9 Nov 2015 09:59:47 +0000 (09:59 +0000)
commitfbe3fc5cb3cd9f9064e98c549684e821c353fe41
tree8a43f761c73026ab222b1793e81cc8596cb217c4
parent37fcee5d1154b7a03c13582e128bcc31ad43e954
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>
aio-posix.c
include/block/aio.h