lkml.org 
[lkml]   [2013]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/6] sched, wait: Collapse __wait_event macros -v4
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.

> > ___wait_event(wq, ___wait_cond_timeout(condition), \
> > TASK_INTERRUPTIBLE, 0, ret, \
> > spin_unlock_irq(&lock); \
> > - __ret = schedule_timeout(__ret); \
> > + ___wait_schedule_timeout(__ret); \
> > spin_lock_irq(&lock));
>
> You can't do that; you'll break/return without the lock held.

Yes, see another email, already noticed this.


And let me repeat just in case, I think this series is fine, just
wait.h needs another minor/orthogonal fix.

Oleg.



\
 
 \ /
  Last update: 2013-09-30 20:41    [W:0.078 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site