On 02/24/2014 07:12 AM, Peter Zijlstra wrote: > Anyway, the below seems to work; it avoids playing tricks with the idle > thread and instead uses a magic constant. > > The comparison should be faster too; seeing how we avoid dereferencing > p->sched_class. > > --- > Subject: sched: Guarantee task priority in pick_next_task() > From: Peter Zijlstra > Date: Fri Feb 14 12:25:08 CET 2014 > > Michael spotted that the idle_balance() push down created a task > priority problem. > > Previously, when we called idle_balance() before pick_next_task() it > wasn't a problem when -- because of the rq->lock droppage -- an rt/dl > task slipped in. > > Similarly for pre_schedule(), rt pre-schedule could have a dl task > slip in. > > But by pulling it into the pick_next_task() loop, we'll not try a > higher task priority again. > > Cure this by creating a re-start condition in pick_next_task(); and > triggering this from pick_next_task_{rt,fair}(). > > Fixes: 38033c37faab ("sched: Push down pre_schedule() and idle_balance()") > Cc: Juri Lelli > Cc: Ingo Molnar > Cc: Steven Rostedt > Reported-by: Michael Wang > Signed-off-by: Peter Zijlstra Sign me up to the fan club of this patch, I love it. After running it for a bit I see that all the hangs I've seen before are gone, even those that I didn't assume were sched related. Thanks, Sasha