Re: [RFC][PATCH 5/5] sched: Reduce ttwu rq->lock contention

From: Peter Zijlstra
Date: Thu Dec 16 2010 - 14:04:02 EST


On Thu, 2010-12-16 at 19:58 +0100, Peter Zijlstra wrote:
> > > + * Since we've already set TASK_WAKING this task's CPU cannot
> > > + * change from under us.
> >
> > I think it can. Yes, we've set TASK_WAKING. But, at least the task
> > itself can change its state back to TASK_RUNNING without calling
> > schedule. Say, __wait_event()-like code.
>
> Oh crud, you're right, that's going to make all this cmpxchg stuff lots
> more interesting :/

Hrmph, we can add a task_is_waking() test to the rq->lock in schedule(),
like we have for __task_rq_lock():

local_irq_save(flags);
again:
while (task_is_waking(current))
cpu_relax();
raw_spin_lock(rq->lock);
if (task_is_waking(current)) {
raw_spin_unlock(rq->lock);
goto again;
}


But that's not particularly pretty...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/