From: Jamie Lokier <jamie@shareable.org>
To: linux-fsdevel@vger.kernel.org
Subject: Re: Bug: epoll_wait timeout is shorter than requested
Date: Mon, 17 Jan 2005 14:43:33 +0000 [thread overview]
Message-ID: <20050117144333.GB23427@mail.shareable.org> (raw)
In-Reply-To: <20050117143348.GA23427@mail.shareable.org>
Jamie Lokier wrote:
> > Well, if the kernel measured the delay more accurately than to a clock
> > tick, it could notice that a requested 1ms would be satisifed by, say,
> > 8ms which remained from the current tick.
>
> I agree 100%! That's a good solution.
>
> If select/poll/epoll were implemented by the kernel reading the
> current time accurately before deciding how many ticks to wait for,
> they could satisfy SUSv3's constraint, _and_ allow the useful
> behaviour of application events at the tick rate, _and_ reduce the
> number of system calls in some programs which call select().
>
> If you want to change the code in fs/select.c and fs/eventpoll.c to do
> this, please do so; I'll be happy to support the case for it.
That said, _any_ change to select/poll is sure to break some programs,
which depend on the current quirks.
By the way, the most logically useful interface would take an
*absolute* end time, in any of the forms that the POSIX timer code allows.
This is because nearly every application which calls select/poll/epoll
with a timeout first calls gettimeofday() and then computes the
difference between an absolute time and the current clock time to pass
as the timeout argument - introducing a race condition in the process.
Giving an absolute time would eliminate the race condition _and_ all
calls to the microsecond timer, which is often quite slow.
However, that would require adding yet another non-standard interface.
Perhaps a case can be made for epoll_wait_abstime or something like
that, seeing as epoll is quite non-standard anyway.
-- Jamie
next prev parent reply other threads:[~2005-01-17 14:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-17 11:15 Bug: epoll_wait timeout is shorter than requested Marcin 'Qrczak' Kowalczyk
2005-01-17 11:48 ` Jamie Lokier
2005-01-17 13:41 ` Marcin 'Qrczak' Kowalczyk
2005-01-17 14:33 ` Jamie Lokier
2005-01-17 14:43 ` Jamie Lokier [this message]
2005-01-17 16:18 ` Marcin 'Qrczak' Kowalczyk
2005-01-17 16:48 ` Jamie Lokier
2005-01-18 23:27 ` Marcin 'Qrczak' Kowalczyk
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=20050117144333.GB23427@mail.shareable.org \
--to=jamie@shareable.org \
--cc=linux-fsdevel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).