[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131001140940.GA32328@redhat.com>
Date: Tue, 1 Oct 2013 16:09:40 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Paul McKenney <paulmck@...ux.vnet.ibm.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 0/6] sched, wait: Collapse __wait_event macros -v4
On 09/30, Oleg Nesterov wrote:
>
> On 09/30, Peter Zijlstra wrote:
> >
> > On Mon, Sep 30, 2013 at 07:40:54PM +0200, Oleg Nesterov wrote:
> > > Once again, of course I do not blame this series, but
> > > wait_event_timeout(wq, true, 0) still returns 0.
> >
> > So we have:
> >
> > [...snip...]
>
> > So wait_event_timeout(wq, true, 0) turns into:
>
> Not really, because of fast-path check,
>
> #define wait_event_timeout(wq, condition, timeout) \
> ({ \
> long __ret = timeout; \
> if (!(condition)) \
> __ret = __wait_event_timeout(wq, condition, timeout); \
> __ret; \
> })
>
> we do not even call __wait_event_timeout() if "condition" is already
> true at the start.
But somehow I didn't realize that ___wait_cond_timeout() can be used
as is, so the simple patch below should work?
Oleg.
--- x/include/linux/wait.h
+++ x/include/linux/wait.h
@@ -270,7 +270,7 @@ do { \
#define wait_event_timeout(wq, condition, timeout) \
({ \
long __ret = timeout; \
- if (!(condition)) \
+ if (!___wait_cond_timeout(condition)) \
__ret = __wait_event_timeout(wq, condition, timeout); \
__ret; \
})
@@ -328,7 +328,7 @@ do { \
#define wait_event_interruptible_timeout(wq, condition, timeout) \
({ \
long __ret = timeout; \
- if (!(condition)) \
+ if (!___wait_cond_timeout(condition)) \
__ret = __wait_event_interruptible_timeout(wq, \
condition, timeout); \
__ret; \
@@ -770,7 +770,7 @@ do { \
timeout) \
({ \
long __ret = timeout; \
- if (!(condition)) \
+ if (!___wait_cond_timeout(condition)) \
__ret = __wait_event_interruptible_lock_irq_timeout( \
wq, condition, lock, timeout); \
__ret; \
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists