qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.3 0/5] aio: Support epoll by introducing qemu_poll abstraction
@ 2014-11-25  8:07 Fam Zheng
  2014-11-25  8:07 ` [Qemu-devel] [PATCH for-2.3 1/5] poll: Introduce QEMU Poll API Fam Zheng
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Fam Zheng @ 2014-11-25  8:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Paolo Bonzini, Stefan Hajnoczi

ppoll(2) doesn't scale as well as epoll: The elapsed time of the syscall is
linear to the number of fd's we poll, which hurts performance a bit when the
number of devices are many, or when a virtio device registers many virtqueues
(virtio-serial, for instance).

To show some data from my test on current master:

 - As a base point (10~20 fd's), it takes 22000 ns for each qemu_poll_ns.
 - Add 10 virtio-serial, which adds some 6 hundreds of fd's in the main loop.
   The time spent in qemu_poll_ns goes up to 75000 ns.

This series introduces qemu_poll, which is implemented  with g_poll and epoll,
decided at configure time with CONFIG_EPOLL.

After this change, the times to do the same thing with qemu_poll (more
precisely, with a sequence of qemu_poll_set_fds(), qemu_poll(),
qemu_poll_get_events() followed by syncing back to gpollfds), are reduced to
21000 ns and 25000 ns, respectively.

We are still not O(1) because as a transition, the qemu_poll_set_fds before
qemu_poll is not optimized out yet.

Fam

Fam Zheng (5):
  poll: Introduce QEMU Poll API
  posix-aio: Use QEMU poll interface
  poll: Add epoll implementation for qemu_poll
  main-loop: Replace qemu_poll_ns with qemu_poll
  tests: Add test case for qemu_poll

 Makefile.objs           |   2 +
 aio-posix.c             |  52 ++++-----
 async.c                 |   5 +-
 include/block/aio.h     |   7 +-
 include/qemu/poll.h     |  40 +++++++
 include/qemu/timer.h    |  13 ---
 include/qemu/typedefs.h |   2 +
 main-loop.c             |  35 ++++++-
 poll-glib.c             | 130 +++++++++++++++++++++++
 poll-linux.c            | 216 ++++++++++++++++++++++++++++++++++++++
 qemu-timer.c            |  21 ----
 tests/Makefile          |   2 +
 tests/test-poll.c       | 272 ++++++++++++++++++++++++++++++++++++++++++++++++
 13 files changed, 723 insertions(+), 74 deletions(-)
 create mode 100644 include/qemu/poll.h
 create mode 100644 poll-glib.c
 create mode 100644 poll-linux.c
 create mode 100644 tests/test-poll.c

-- 
1.9.3

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-11-26  5:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-25  8:07 [Qemu-devel] [PATCH for-2.3 0/5] aio: Support epoll by introducing qemu_poll abstraction Fam Zheng
2014-11-25  8:07 ` [Qemu-devel] [PATCH for-2.3 1/5] poll: Introduce QEMU Poll API Fam Zheng
2014-11-25  8:07 ` [Qemu-devel] [PATCH for-2.3 2/5] posix-aio: Use QEMU poll interface Fam Zheng
2014-11-25  8:07 ` [Qemu-devel] [PATCH for-2.3 3/5] poll: Add epoll implementation for qemu_poll Fam Zheng
2014-11-25 13:38   ` Stefan Hajnoczi
2014-11-26  1:48     ` Fam Zheng
2014-11-25  8:07 ` [Qemu-devel] [PATCH for-2.3 4/5] main-loop: Replace qemu_poll_ns with qemu_poll Fam Zheng
2014-11-25  8:07 ` [Qemu-devel] [PATCH for-2.3 5/5] tests: Add test case for qemu_poll Fam Zheng
2014-11-25 13:52 ` [Qemu-devel] [PATCH for-2.3 0/5] aio: Support epoll by introducing qemu_poll abstraction Stefan Hajnoczi
2014-11-25 13:56   ` Paolo Bonzini
2014-11-26  5:27   ` Fam Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).