Commit c259ef84 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] Fix msleep to sleep _at_least_ the requested amount

Makes sure msleep() sleeps at least the amount provided, since
schedule_timeout() doesn't guarantee a full jiffy.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 23493c98
...@@ -1605,7 +1605,7 @@ unregister_time_interpolator(struct time_interpolator *ti) ...@@ -1605,7 +1605,7 @@ unregister_time_interpolator(struct time_interpolator *ti)
*/ */
void msleep(unsigned int msecs) void msleep(unsigned int msecs)
{ {
unsigned long timeout = msecs_to_jiffies(msecs); unsigned long timeout = msecs_to_jiffies(msecs) + 1;
while (timeout) { while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
...@@ -1621,7 +1621,7 @@ EXPORT_SYMBOL(msleep); ...@@ -1621,7 +1621,7 @@ EXPORT_SYMBOL(msleep);
*/ */
unsigned long msleep_interruptible(unsigned int msecs) 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)) { while (timeout && !signal_pending(current)) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment