diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-06-23 12:48:50 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-06-23 12:48:50 -0700 |
commit | 0e053738b50836e9d1e94b2295ef2942eb471078 (patch) | |
tree | 35f271173acd7dcab75cb8c6d6af6eb9f1ff3369 /kernel/sched.c | |
parent | ee5c2ab09b79d3aba3515a3eae7c5cf1e2cbc569 (diff) | |
parent | 198bb971e256e4167e45e7df643c13ea66f67e3a (diff) | |
download | kernel-crypto-0e053738b50836e9d1e94b2295ef2942eb471078.tar.gz kernel-crypto-0e053738b50836e9d1e94b2295ef2942eb471078.tar.xz kernel-crypto-0e053738b50836e9d1e94b2295ef2942eb471078.zip |
Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
sched: refactor wait_for_completion_timeout()
sched: fix wait_for_completion_timeout() spurious failure under heavy load
sched: rt: dont stop the period timer when there are tasks wanting to run
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index b048ad8a11a..3aaa5c8cb42 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -4398,22 +4398,20 @@ do_wait_for_common(struct completion *x, long timeout, int state) signal_pending(current)) || (state == TASK_KILLABLE && fatal_signal_pending(current))) { - __remove_wait_queue(&x->wait, &wait); - return -ERESTARTSYS; + timeout = -ERESTARTSYS; + break; } __set_current_state(state); spin_unlock_irq(&x->wait.lock); timeout = schedule_timeout(timeout); spin_lock_irq(&x->wait.lock); - if (!timeout) { - __remove_wait_queue(&x->wait, &wait); - return timeout; - } - } while (!x->done); + } while (!x->done && timeout); __remove_wait_queue(&x->wait, &wait); + if (!x->done) + return timeout; } x->done--; - return timeout; + return timeout ?: 1; } static long __sched |