On Tue, 07 Jun 2016 21:56:36 +0200 Peter Zijlstra <pet...@infradead.org> wrote:
> From: Xunlei Pang <xlp...@redhat.com> > > We should deboost before waking the high-prio task, such that > we don't run two tasks with the same "state"(priority, deadline, > sched_class, etc) during the period between the end of wake_up_q() > and the end of rt_mutex_adjust_prio(). > > As "Peter Zijlstra" said: > Its semantically icky to have the two tasks running off the same > state and practically icky when you consider bandwidth inheritance -- > where the boosted task wants to explicitly modify the state of the > booster. In that latter case you really want to unboost before you > let the booster run again. > > But this however can lead to prio-inversion if current would get > preempted after the deboost but before waking our high-prio task, > hence we disable preemption before doing deboost, and enabling it > after the wake up is over. > > The patch fixed the logic, and introduced rt_mutex_postunlock() > to do some code refactor. > > Most importantly however; this change ensures pointer stability for > the next patch, where we have rt_mutex_setprio() cache a pointer to > the top-most waiter task. If we, as before this change, do the wakeup > first and then deboost, this pointer might point into thin air. > > Cc: Steven Rostedt <rost...@goodmis.org> Acked-by: Steven Rostedt <rost...@goodmis.org> -- Steve > Cc: Ingo Molnar <mi...@redhat.com> > Cc: Juri Lelli <juri.le...@arm.com> > Suggested-by: Peter Zijlstra <pet...@infradead.org> > [peterz: Changelog] > Signed-off-by: Xunlei Pang <xlp...@redhat.com> > Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org> > Link: > http://lkml.kernel.org/r/1461659449-19497-1-git-send-email-xlp...@redhat.com > ---