lkml.org 
[lkml]   [2010]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH 5/5] sched: Reduce ttwu rq->lock contention
From
Date
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...


\
 
 \ /
  Last update: 2010-12-16 20:07    [W:0.087 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site