[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101217192814.GA16133@redhat.com>
Date: Fri, 17 Dec 2010 20:28:14 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Chris Mason <chris.mason@...cle.com>,
Frank Rowand <frank.rowand@...sony.com>,
Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>,
Mike Galbraith <efault@....de>, Paul Turner <pjt@...gle.com>,
Jens Axboe <axboe@...nel.dk>, linux-kernel@...r.kernel.org
Subject: Re: [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.
--
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