[ovs-dev] [PATCH 4/5] pool-loop: Enable checking whether a FD caused a wakeup.

Jesse Gross jesse at nicira.com
Thu Sep 22 20:58:49 UTC 2011


On Thu, Sep 22, 2011 at 12:48 PM, Ben Pfaff <blp at nicira.com> wrote:
> On Mon, Sep 19, 2011 at 03:00:07PM -0700, Jesse Gross wrote:
>> Each time we run through the poll loop, we check all file descriptors
>> that we were waiting on to see if there is data available.  However,
>> this requires a system call and poll already provides information on
>> which FDs caused the wakeup so it is inefficient as the number of
>> active FDs grows.  This provides a way to check whether a given FD
>> has data.
>
> s/pool/poll/ in subject.

Wow, I have a lot of typos in this patchset.

> I'm nervous about using linear search here, since we'll be growing the
> number of fds significantly.

I thought about this before but the problem is that you trade off the
cost of the doing a single lookup for increased cost in building
whatever data structure you use to get better than linear performance.
 In this case we actually rebuild it quite frequently (each trip
through the poll loop) so it wasn't clear to me that it was a good
tradeoff.  I can think of some ways to optimize this (for one thing,
we probably have the same set of FDs the vast majority of the time)
but I didn't want to go too far down that path without data as it
whether it's a real problem.

> I think that poll_fd_woke() is inadequate in the case where a single
> fd has been inserted by multiple calls to poll_fd_wait().  It should
> presumably check for all instances and "or" their revents together.

That's probably a good idea.



More information about the dev mailing list