[PATCH][RESEND] Fix msleep to sleep _at_least_ the requested amount

From: Benjamin Herrenschmidt
Date: Sun Oct 24 2004 - 19:24:30 EST


Hi Linus !

You "agreed" but didn't apply the patch on the last message ... so here
it is again.


Makes sure msleep() sleeps at least the amount provided, since
schedule_timeout() doesn't guarantee a full jiffy.

Signed-off-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>

===== kernel/timer.c 1.100 vs edited =====
--- 1.100/kernel/timer.c 2004-10-19 19:40:28 +10:00
+++ edited/kernel/timer.c 2004-10-23 09:16:10 +10:00
@@ -1605,7 +1605,7 @@
*/
void msleep(unsigned int msecs)
{
- unsigned long timeout = msecs_to_jiffies(msecs);
+ unsigned long timeout = msecs_to_jiffies(msecs) + 1;

while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
@@ -1621,7 +1621,7 @@
*/
unsigned long msleep_interruptible(unsigned int msecs)
{
- unsigned long timeout = msecs_to_jiffies(msecs);
+ unsigned long timeout = msecs_to_jiffies(msecs) + 1;

while (timeout && !signal_pending(current)) {
set_current_state(TASK_INTERRUPTIBLE);


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