On Tue, 07 Jun 2016 21:56:36 +0200
Peter Zijlstra <[email protected]> wrote:

> From: Xunlei Pang <[email protected]>
> 
> 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 <[email protected]>

Acked-by: Steven Rostedt <[email protected]>

-- Steve

> Cc: Ingo Molnar <[email protected]>
> Cc: Juri Lelli <[email protected]>
> Suggested-by: Peter Zijlstra <[email protected]>
> [peterz: Changelog]
> Signed-off-by: Xunlei Pang <[email protected]>
> Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
> Link: 
> http://lkml.kernel.org/r/[email protected]
> ---

Reply via email to