Re: [REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly

2012-10-10 Thread Andi Kleen
> 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(). You're right, but it would probably only matter for inlining

Re: [REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly

2012-10-10 Thread Andi Kleen
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(). You're right, but it would probably only matter for inlining with LTO (if the

Re: [REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly

2012-10-09 Thread Oleg Nesterov
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

Re: [REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly

2012-10-09 Thread Peter Zijlstra
On Tue, 2012-10-09 at 06:37 -0700, Andi Kleen wrote: > Ivo Sieben writes: > > > Check the waitqueue task list to be non empty before entering the critical > > section. This prevents locking the spin lock needlessly in case the queue > > was empty, and therefor also prevent scheduling overhead on

Re: [REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly

2012-10-09 Thread Andi Kleen
Ivo Sieben writes: > Check the waitqueue task list to be non empty before entering the critical > section. This prevents locking the spin lock needlessly in case the queue > was empty, and therefor also prevent scheduling overhead on a PREEMPT_RT > system. > > Signed-off-by: Ivo Sieben > --- >

[REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly

2012-10-09 Thread Ivo Sieben
Check the waitqueue task list to be non empty before entering the critical section. This prevents locking the spin lock needlessly in case the queue was empty, and therefor also prevent scheduling overhead on a PREEMPT_RT system. Signed-off-by: Ivo Sieben --- REPOST: Request for comments: -

[REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly

2012-10-09 Thread Ivo Sieben
Check the waitqueue task list to be non empty before entering the critical section. This prevents locking the spin lock needlessly in case the queue was empty, and therefor also prevent scheduling overhead on a PREEMPT_RT system. Signed-off-by: Ivo Sieben meltedpiano...@gmail.com --- REPOST:

Re: [REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly

2012-10-09 Thread Andi Kleen
Ivo Sieben meltedpiano...@gmail.com writes: Check the waitqueue task list to be non empty before entering the critical section. This prevents locking the spin lock needlessly in case the queue was empty, and therefor also prevent scheduling overhead on a PREEMPT_RT system. Signed-off-by:

Re: [REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly

2012-10-09 Thread Peter Zijlstra
On Tue, 2012-10-09 at 06:37 -0700, Andi Kleen wrote: Ivo Sieben meltedpiano...@gmail.com writes: Check the waitqueue task list to be non empty before entering the critical section. This prevents locking the spin lock needlessly in case the queue was empty, and therefor also prevent

Re: [REPOST] RFC: sched: Prevent wakeup to enter critical section needlessly

2012-10-09 Thread Oleg Nesterov
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