lkml.org 
[lkml]   [2003]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: {sys_,/dev/}epoll waiting timeout
On Thu, Jan 23, 2003 at 03:43:04PM +0000, Jamie Lokier wrote:
> Davide Libenzi wrote:
> > >From a mathematical point of view this is a ceil(v)+1, so this is wrong.
> > It should be :
> > t = (t * HZ + 999) / 1000;
> > The +999 already gives you the round up. Different is if we want to be
> > sure to sleep at least that amount of jiffies ( the rounded up ), in that
> > case since the timer tick might arrive immediately after we go to sleep by
> > making us to lose immediately a jiffie, we need another +1. Anyway I'll do
> > the round up. Same for the overflow check.
> I wonder if it's appropriate to copy sys_poll(), which has the +1, or
> sys_select(), which doesn't!

Or, fix sys_poll(). With the +1, this means that sys_poll() would have
a 1 in 1001 chance per second of returning one jiffie too early.

> > > And that the prototypes for ep_poll() and sys_epoll_wait() be changed
> > > to take a "long timeout" instead of an "int", just like sys_poll().
> > I don't see why. The poll(2) timeout is an int.
> poll(2) takes an int, but sys_poll() takes a long.
> I think everyone is confused :)
> The reason I suggested "long timeout" for ep_poll is because the
> multiply in the expression:
> jtimeout = (unsigned long)(timeout*HZ+999)/1000;
> can overflow if you don't. If you stick with the int, you'll need to
> write:
> jtimeout = (((unsigned long)timeout)*HZ+999)/1000;

On a 16 bit platform, perhaps... :-)

mark

--
mark@mielke.cc/markm@ncf.ca/markm@nortelnetworks.com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/

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

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.072 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site