Re: [Qemu-devel] [PATCH 2/2] iohandler: Add Linux implementation of iohandler GSource

2014-09-26 Thread Paolo Bonzini
Il 26/09/2014 03:23, Fam Zheng ha scritto: > > Also, as an extra optimization perhaps you can make a second list with > > iohandlers that were modified or have a read_poll handler, and only call > > iohandler_get_events on that one. > > Sounds good, but I need to benchmark it to tell :) > > There

Re: [Qemu-devel] [PATCH 2/2] iohandler: Add Linux implementation of iohandler GSource

2014-09-25 Thread Fam Zheng
On Thu, 09/25 21:45, Paolo Bonzini wrote: > Il 25/09/2014 19:21, Fam Zheng ha scritto: > > +while (true) { > > +r = epoll_pwait(s->epollfd.fd, events, MAX_EVENTS, 0, &origmask); > > You can save a syscall by doing this just once. You would just get a > readable epoll file descriptor o

Re: [Qemu-devel] [PATCH 2/2] iohandler: Add Linux implementation of iohandler GSource

2014-09-25 Thread Paolo Bonzini
Il 25/09/2014 19:21, Fam Zheng ha scritto: > +while (true) { > +r = epoll_pwait(s->epollfd.fd, events, MAX_EVENTS, 0, &origmask); You can save a syscall by doing this just once. You would just get a readable epoll file descriptor on the next main loop iteration. Also, origmask is an

[Qemu-devel] [PATCH 2/2] iohandler: Add Linux implementation of iohandler GSource

2014-09-25 Thread Fam Zheng
The Linux-specific syscall epoll(7) has a constant complexity, whereas ppoll/g_poll is linear complexity, depending on the number of fds. The event loop is more efficient with epoll, because we only need to poll on few fds now. Sometimes EPOLL_CTL_ADD returns -1 with errno = EPERM, when the targe