Messages in this thread Patch in this message | | | Date | Sat, 24 Sep 2005 21:47:43 +0200 | From | Willy Tarreau <> | Subject | [PATCH 2/3] 2.6.14-rc2-mm1: fixes for overflow in epoll() |
| |
This patch fixes the potential timeout overflow in ep_poll(), tries to get the best timeout and also removes the /1000 divide whenever possible. It mostly ensures that timeout computation is uniform with other places in the kernel.
This patch applies both to 2.6.14-rc2-mm1 and 2.6.14-rc2.
Please review and apply.
Signed-off-by: Willy Tarreau <willy@w.ods.org>
- Willy
diff -purN linux-2.6.14-rc2-mm1/fs/eventpoll.c linux-2.6.14-rc2-mm1-epoll/fs/eventpoll.c --- linux-2.6.14-rc2-mm1/fs/eventpoll.c Sat Sep 24 21:11:49 2005 +++ linux-2.6.14-rc2-mm1-epoll/fs/eventpoll.c Sat Sep 24 21:20:10 2005 @@ -1502,12 +1502,11 @@ static int ep_poll(struct eventpoll *ep, wait_queue_t wait; /* - * Calculate the timeout by checking for the "infinite" value ( -1 ) - * and the overflow condition. The passed timeout is in milliseconds, - * that why (t * HZ) / 1000. + * Calculate the timeout by checking for the "infinite" value ( < 0 ) + * and the overflow condition. The passed timeout is in milliseconds. */ - jtimeout = timeout == -1 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ? - MAX_SCHEDULE_TIMEOUT: (timeout * HZ + 999) / 1000; + jtimeout = (timeout < 0) ? + MAX_SCHEDULE_TIMEOUT : msecs_to_jiffies(timeout); retry: write_lock_irqsave(&ep->lock, flags);
- 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/
| |