[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1101260747320.1889@localhost6.localdomain6>
Date: Wed, 26 Jan 2011 07:52:23 -0800 (PST)
From: Davide Libenzi <davidel@...ilserver.org>
To: Eric Dumazet <eric.dumazet@...il.com>
cc: Simon Kirby <sim@...tway.ca>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Shawn Bohrer <shawn.bohrer@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: sys_epoll_wait high CPU load in 2.6.37
On Wed, 26 Jan 2011, Eric Dumazet wrote:
> Le mercredi 26 janvier 2011 à 07:31 -0800, Davide Libenzi a écrit :
> > On Wed, 26 Jan 2011, Eric Dumazet wrote:
> >
>
> > > diff --git a/fs/eventpoll.c b/fs/eventpoll.c
> > > index cc8a9b7..7ec0890 100644
> > > --- a/fs/eventpoll.c
> > > +++ b/fs/eventpoll.c
> > > @@ -1126,7 +1126,9 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
> > >
> > > if (timeout > 0) {
> > > ktime_get_ts(&end_time);
> > > - timespec_add_ns(&end_time, (u64)timeout * NSEC_PER_MSEC);
> > > + end_time.tv_sec += timeout / MSEC_PER_SEC;
> > > + timeout %= MSEC_PER_SEC;
> > > + timespec_add_ns(&end_time, timeout * NSEC_PER_MSEC);
> > > slack = select_estimate_accuracy(&end_time);
> > > to = &expires;
> > > *to = timespec_to_ktime(end_time);
> >
> > Yep, we can overflow the timeout, with the calculation above.
> > A timespec_add_ms()?
>
> Well, given timeout after modulo contains a number between 0 and 999,
> multiply by 1.000.000 (NSEC_PER_MSEC) cant overflow.
For "above", I meant the current epoll expire time calculation, which was
described above in the message ;)
The hint for a timespec_add_ms() was because we must be doing something
similar in poll, don't we (/me got no code in front ATM)?
Powered by blists - more mailing lists