* [patch] Make epoll_wait() handle negative timeouts as MAX_SCHEDULE_TIMEOUT ...
@ 2005-09-23 17:37 Davide Libenzi
2005-09-23 17:42 ` Nish Aravamudan
0 siblings, 1 reply; 3+ messages in thread
From: Davide Libenzi @ 2005-09-23 17:37 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: Andrew Morton
[-- Attachment #1: Type: TEXT/PLAIN, Size: 198 bytes --]
As reported by Vadim Lobanov, epoll_wait() did not handle correctly
timeouts <0 (only the -1 case was MAX_SCHEDULE_TIMEOUT'd).
Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
- Davide
[-- Attachment #2: Type: TEXT/PLAIN, Size: 472 bytes --]
--- a/fs/eventpoll.c 2005-09-23 10:06:45.000000000 -0700
+++ b/fs/eventpoll.c 2005-09-23 10:09:35.000000000 -0700
@@ -1507,7 +1507,7 @@
* and the overflow condition. The passed timeout is in milliseconds,
* that why (t * HZ) / 1000.
*/
- jtimeout = timeout == -1 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ?
+ jtimeout = timeout < 0 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ?
MAX_SCHEDULE_TIMEOUT: (timeout * HZ + 999) / 1000;
retry:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Make epoll_wait() handle negative timeouts as MAX_SCHEDULE_TIMEOUT ...
2005-09-23 17:37 [patch] Make epoll_wait() handle negative timeouts as MAX_SCHEDULE_TIMEOUT Davide Libenzi
@ 2005-09-23 17:42 ` Nish Aravamudan
2005-09-23 18:04 ` Davide Libenzi
0 siblings, 1 reply; 3+ messages in thread
From: Nish Aravamudan @ 2005-09-23 17:42 UTC (permalink / raw)
To: Davide Libenzi; +Cc: Linux Kernel Mailing List, Andrew Morton
On 9/23/05, Davide Libenzi <davidel@xmailserver.org> wrote:
>
> As reported by Vadim Lobanov, epoll_wait() did not handle correctly
> timeouts <0 (only the -1 case was MAX_SCHEDULE_TIMEOUT'd).
>
>
> Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
Arrgggh, this is as wrong as sys_poll() was before! :)
--- a/fs/eventpoll.c 2005-09-23 10:06:45.000000000 -0700
+++ b/fs/eventpoll.c 2005-09-23 10:09:35.000000000 -0700
@@ -1507,7 +1507,7 @@
* and the overflow condition. The passed timeout is in milliseconds,
* that why (t * HZ) / 1000.
*/
- jtimeout = timeout == -1 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ?
+ jtimeout = timeout < 0 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ?
@timeout is in miliseconds, per the comment, yes? If so, then
timeout [msecs] > MAX_SCHEDULE_TIMEOUT [jiffies] - 1000 [jiffies] / HZ
[jiffies / sec]
compares milliseconds to seconds! (Don't worry, sys_poll() had the
same error for a long time). There is a patch in 2.6.14-rc2-mm1 for
sys_poll() to fix the handling of long timeouts, please take a look
and maybe apply the same ideas to epoll(). Alexey Dobriyan has filed a
regression against the patch, but I'm unable to reproduce it (and it
could be an app depending on the old broken behavior).
Thanks,
Nish
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Make epoll_wait() handle negative timeouts as MAX_SCHEDULE_TIMEOUT ...
2005-09-23 17:42 ` Nish Aravamudan
@ 2005-09-23 18:04 ` Davide Libenzi
0 siblings, 0 replies; 3+ messages in thread
From: Davide Libenzi @ 2005-09-23 18:04 UTC (permalink / raw)
To: Nish Aravamudan; +Cc: Linux Kernel Mailing List, Andrew Morton
On Fri, 23 Sep 2005, Nish Aravamudan wrote:
> On 9/23/05, Davide Libenzi <davidel@xmailserver.org> wrote:
>>
>> As reported by Vadim Lobanov, epoll_wait() did not handle correctly
>> timeouts <0 (only the -1 case was MAX_SCHEDULE_TIMEOUT'd).
>>
>>
>> Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
>
> Arrgggh, this is as wrong as sys_poll() was before! :)
>
> --- a/fs/eventpoll.c 2005-09-23 10:06:45.000000000 -0700
> +++ b/fs/eventpoll.c 2005-09-23 10:09:35.000000000 -0700
> @@ -1507,7 +1507,7 @@
> * and the overflow condition. The passed timeout is in milliseconds,
> * that why (t * HZ) / 1000.
> */
> - jtimeout = timeout == -1 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ?
> + jtimeout = timeout < 0 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ?
>
> @timeout is in miliseconds, per the comment, yes? If so, then
>
> timeout [msecs] > MAX_SCHEDULE_TIMEOUT [jiffies] - 1000 [jiffies] / HZ
> [jiffies / sec]
Sh*t, you're right! Reposting soon.
- Davide
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-09-23 18:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-23 17:37 [patch] Make epoll_wait() handle negative timeouts as MAX_SCHEDULE_TIMEOUT Davide Libenzi
2005-09-23 17:42 ` Nish Aravamudan
2005-09-23 18:04 ` Davide Libenzi
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.