[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] iohandler: Add Linux implementation of ioha
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] iohandler: Add Linux implementation of iohandler GSource |
Date: |
Fri, 26 Sep 2014 09:23:51 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
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 on the next main loop iteration.
There is only one call here if r < MAX_EVENTS, which is the normal case.
> Also,
> origmask is an input parameter, so you need to use epoll_wait.
Yeah, I missed the point completely. :p
>
> 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 isn't a lot of computation if there is no read_poll.
>
> Perhaps this together lowers the cost of epoll enough to more easily
> reach the break-even point.
Dynamic swithing between ppoll and epoll shoudn't be hard to implement, but I'm
not sure how to write the condition. Anyway, do you think it is a good idea?
Fam
>
> Though I wonder if it would be acceptable to make ioeventfd off by
> default for virtio-serial...
>
> Thanks,
>
> Paolo