aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-10-07 14:31:06 -0400
committerIngo Molnar <mingo@kernel.org>2013-10-16 08:22:17 -0400
commit8922915b38cd8b72f8e5af614b95be71d1d299d4 (patch)
treed0770b40ff4d01aaaf050a651c717337b237294e
parent6acce3ef84520537f8a09a12c9ddbe814a584dd2 (diff)
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: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20131007183106.GA10973@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--include/linux/wait.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a2726c7dd244..04c0260bda8f 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -270,7 +270,7 @@ do { \
270#define wait_event_timeout(wq, condition, timeout) \ 270#define wait_event_timeout(wq, condition, timeout) \
271({ \ 271({ \
272 long __ret = timeout; \ 272 long __ret = timeout; \
273 if (!(condition)) \ 273 if (!___wait_cond_timeout(condition)) \
274 __ret = __wait_event_timeout(wq, condition, timeout); \ 274 __ret = __wait_event_timeout(wq, condition, timeout); \
275 __ret; \ 275 __ret; \
276}) 276})
@@ -328,7 +328,7 @@ do { \
328#define wait_event_interruptible_timeout(wq, condition, timeout) \ 328#define wait_event_interruptible_timeout(wq, condition, timeout) \
329({ \ 329({ \
330 long __ret = timeout; \ 330 long __ret = timeout; \
331 if (!(condition)) \ 331 if (!___wait_cond_timeout(condition)) \
332 __ret = __wait_event_interruptible_timeout(wq, \ 332 __ret = __wait_event_interruptible_timeout(wq, \
333 condition, timeout); \ 333 condition, timeout); \
334 __ret; \ 334 __ret; \
@@ -769,7 +769,7 @@ do { \
769 timeout) \ 769 timeout) \
770({ \ 770({ \
771 long __ret = timeout; \ 771 long __ret = timeout; \
772 if (!(condition)) \ 772 if (!___wait_cond_timeout(condition)) \
773 __ret = __wait_event_interruptible_lock_irq_timeout( \ 773 __ret = __wait_event_interruptible_lock_irq_timeout( \
774 wq, condition, lock, timeout); \ 774 wq, condition, lock, timeout); \
775 __ret; \ 775 __ret; \