Re: [RFC][PATCH 3/8] sched/deadline/rtmutex: Dont miss the dl_runtime/dl_period update

From: Peter Zijlstra
Date: Wed Jun 15 2016 - 13:55:25 EST


On Wed, Jun 15, 2016 at 12:30:07PM -0400, Steven Rostedt wrote:

> > +++ b/kernel/locking/rtmutex.c
> > @@ -488,7 +488,7 @@ static int rt_mutex_adjust_prio_chain(st
> > * enabled we continue, but stop the requeueing in the chain
> > * walk.
> > */
> > - if (waiter->prio == task->prio) {
> > + if (waiter->prio == task->prio && !dl_task(task)) {
>
> Isn't task the owner of the lock?

No, task is blocked on something.

> What happens if the waiter is a
> deadline task?

So the test here is a shortcut to terminate the Pi chain adjust, it says
that if the waiter and task have the same priority, we're done. Further
adjustments will not make a difference.

The problem is that for deadline tasks, prio is a useless number, so
even if they match (all deadline tasks have prio -1) they might still
not actually match.

After the last patch I suppose we could do something like:

waiter->prio == task->prio && waiter->deadline == task->dl.deadline

In any case, any condition that compares just two 'prio' values is per
definition broken if DL tasks are involved.