From: Mark Mielke <mark@mark.mielke.cc>
To: Jamie Lokier <jamie@shareable.org>
Cc: Davide Libenzi <davidel@xmailserver.org>,
Lennert Buytenhek <buytenh@math.leidenuniv.nl>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: {sys_,/dev/}epoll waiting timeout
Date: Thu, 23 Jan 2003 12:27:34 -0500 [thread overview]
Message-ID: <20030123172734.GA2490@mark.mielke.cc> (raw)
In-Reply-To: <20030123154304.GA7665@bjl1.asuk.net>
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/
next prev parent reply other threads:[~2003-01-23 17:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-22 6:55 {sys_,/dev/}epoll waiting timeout Lennert Buytenhek
2003-01-22 8:03 ` Jamie Lokier
2003-01-22 12:46 ` Ed Tomlinson
2003-01-22 13:20 ` Jamie Lokier
2003-01-22 19:14 ` Randy.Dunlap
2003-01-22 19:34 ` Jamie Lokier
2003-01-22 19:32 ` Randy.Dunlap
2003-01-23 14:07 ` Davide Libenzi
2003-01-23 15:43 ` Jamie Lokier
2003-01-23 17:27 ` Mark Mielke [this message]
2003-01-23 18:28 ` Jamie Lokier
2003-01-23 20:40 ` Mark Mielke
2003-01-23 22:18 ` Jamie Lokier
2003-01-24 14:41 ` Andreas Schwab
2003-01-25 1:08 ` Davide Libenzi
2003-01-27 21:27 ` bug in select() (was Re: {sys_,/dev/}epoll waiting timeout) Bill Rugolsky Jr.
2003-01-27 22:52 ` Davide Libenzi
2003-01-28 9:45 ` Jamie Lokier
2003-01-28 10:52 ` Mark Mielke
2003-01-28 21:39 ` Jamie Lokier
2003-01-28 22:15 ` Davide Libenzi
2003-01-28 19:42 ` {sys_,/dev/}epoll waiting timeout Randy.Dunlap
2003-01-28 21:36 ` Jamie Lokier
2003-01-28 21:44 ` David Mosberger
[not found] <20030122080322.GB3466@bjl1.asuk.net.suse.lists.linux.kernel>
[not found] ` <Pine.LNX.4.33L2.0301281139570.30636-100000@dragon.pdx.osdl.net.suse.lists.linux.kernel>
[not found] ` <20030128213621.GA29036@bjl1.asuk.net.suse.lists.linux.kernel>
2003-01-28 21:55 ` Andi Kleen
2003-01-28 22:24 ` Davide Libenzi
2003-01-28 22:39 ` Andi Kleen
2003-01-28 23:00 ` Davide Libenzi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030123172734.GA2490@mark.mielke.cc \
--to=mark@mark.mielke.cc \
--cc=buytenh@math.leidenuniv.nl \
--cc=davidel@xmailserver.org \
--cc=jamie@shareable.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.