lkml.org 
[lkml]   [2012]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly
On 10/09, Peter Zijlstra wrote:
>
> One thing you might need to consider is the memory ordering, will the
> list_empty -- either careful or not -- observe the right list pointer,
> or could it -- when racing with wait_event()/prepare_to_wait() --
> observe a stale value. Or.. is that all already covered in on the use
> site.

I agree.

Without spin_lock(q->lock) (or some other barriers) wait_event-like
code can miss an event.

wait_event:

prepare_to_wait(wq) // takes wq->lock

if (!CONDITION)
schedule();

Now,

CONDITION = 1;
wake_up(wq);

at least need the full mb() before lits_empty().

Oleg.



\
 
 \ /
  Last update: 2012-10-09 18:01    [W:1.088 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site