Commit 8922915b authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Ingo Molnar

sched/wait: Add ___wait_cond_timeout() to wait_event*_timeout() too

Commit 4c663cfc ("wait: fix false timeouts when using
wait_event_timeout()") introduced the additional condition checks
after a timeout but only in the "slow" __wait*() paths.

wait_event_timeout(wq, CONDITION, 0) still returns 0 if CONDITION
is already true and we do not call __wait*().

Now that we have ___wait_cond_timeout() we can use it instead to
ensure that __ret will be properly updated.
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20131007183106.GA10973@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 6acce3ef
...@@ -270,7 +270,7 @@ do { \ ...@@ -270,7 +270,7 @@ do { \
#define wait_event_timeout(wq, condition, timeout) \ #define wait_event_timeout(wq, condition, timeout) \
({ \ ({ \
long __ret = timeout; \ long __ret = timeout; \
if (!(condition)) \ if (!___wait_cond_timeout(condition)) \
__ret = __wait_event_timeout(wq, condition, timeout); \ __ret = __wait_event_timeout(wq, condition, timeout); \
__ret; \ __ret; \
}) })
...@@ -328,7 +328,7 @@ do { \ ...@@ -328,7 +328,7 @@ do { \
#define wait_event_interruptible_timeout(wq, condition, timeout) \ #define wait_event_interruptible_timeout(wq, condition, timeout) \
({ \ ({ \
long __ret = timeout; \ long __ret = timeout; \
if (!(condition)) \ if (!___wait_cond_timeout(condition)) \
__ret = __wait_event_interruptible_timeout(wq, \ __ret = __wait_event_interruptible_timeout(wq, \
condition, timeout); \ condition, timeout); \
__ret; \ __ret; \
...@@ -769,7 +769,7 @@ do { \ ...@@ -769,7 +769,7 @@ do { \
timeout) \ timeout) \
({ \ ({ \
long __ret = timeout; \ long __ret = timeout; \
if (!(condition)) \ if (!___wait_cond_timeout(condition)) \
__ret = __wait_event_interruptible_lock_irq_timeout( \ __ret = __wait_event_interruptible_lock_irq_timeout( \
wq, condition, lock, timeout); \ wq, condition, lock, timeout); \
__ret; \ __ret; \
......
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