lkml.org 
[lkml]   [2010]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateFri, 17 Dec 2010 20:28:14 +0100
FromOleg Nesterov <>
SubjectRe: [RFC][PATCH 5/5] sched: Reduce ttwu rq->lock contention
On 12/17, Peter Zijlstra wrote:
>
> By fully serializing all wakeups using ->pi_lock it becomes a lot
> simpler

Hmm, yes. Contrary to my expectations ;)

> static int
> try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
> {
> unsigned long flags;
> int cpu, ret = 0;
>
> smp_wmb();
> raw_spin_lock_irqsave(&p->pi_lock, flags);
>
> if (!(p->state & state))
> goto unlock;
>
> ret = 1; /* we qualify as a proper wakeup now */
>
> if (p->se.on_rq && ttwu_force(p, state, wake_flags))
> goto unlock;

Well. All I can say, I'll try to re-read this code with the fresh head ;)
We should ensure that on_rq == 0 can not be racy.

> p->state = TASK_WAKING;
> smp_wmb();
> raw_spin_unlock_wait(&task_rq(p)->lock);

This needs smp_mb(), unlock_wait() reads the memory.

Oleg.



\
 
 \ /
  Last update: 2010-12-17 20:37    [from the cache]
©2003-2010