Messages in this thread | | | Subject | Re: [RFC][PATCH 5/5] sched: Reduce ttwu rq->lock contention | From | Peter Zijlstra <> | Date | Thu, 16 Dec 2010 20:03:40 +0100 |
| |
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...
| |