Re: sys_epoll_wait high CPU load in 2.6.37

From: Davide Libenzi
Date: Wed Jan 26 2011 - 13:06:52 EST


On Wed, 26 Jan 2011, Eric Dumazet wrote:

> > > --- a/fs/eventpoll.c
> > > +++ b/fs/eventpoll.c
> > > @@ -1125,8 +1125,8 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
> > > ktime_t expires, *to = NULL;
> > >
> > > if (timeout > 0) {
> > > - ktime_get_ts(&end_time);
> > > - timespec_add_ns(&end_time, (u64)timeout * NSEC_PER_MSEC);
> > > + poll_select_set_timeout(&end_time, timeout / MSEC_PER_SEC,
> > > + NSEC_PER_MSEC * (timeout % MSEC_PER_SEC));
> > > slack = select_estimate_accuracy(&end_time);
> > > to = &expires;
> > > *to = timespec_to_ktime(end_time);
> >
> > poll_select_set_timeout() jumps through some extra hoops that
> > aren't necessary in the epoll case so I actually like your previous
> > patch better.
>
> Well, I dont care, I let Davide decide, he is the boss ;)
>
> This is a stable candidate, so adding timespec_add_ms() sounds overkill.

Eric, if you look at fs/select.c (~line 925), poll does exactly the same
thing as epoll do.
It too, ignores the eventual return value of poll_select_set_timeout(), so
maybe a little bit more optimized ktime_get_ts+timespec_add_ms could make
sense.


- Davide


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/