On Mon, Sep 26, 2016 at 11:20:58AM -0400, Steven Rostedt wrote:
> > --- a/kernel/locking/rtmutex.c
> > +++ b/kernel/locking/rtmutex.c
> > @@ -256,6 +256,16 @@ rt_mutex_dequeue_pi(struct task_struct *
> >     RB_CLEAR_NODE(&waiter->pi_tree_entry);
> >  }
> >  
> 
> Shouldn't we add a comment about what locks are expected to be held
> when calling this? Especially if it can be called outside this file.

Comments are somewhat useless.. I would like to do the below, except I
cannot.

> > +void rt_mutex_update_top_task(struct task_struct *p)
> > +{

        lockdep_assert_held(&p->pi_lock);
        lockdep_assert_held(&task_rq(p)->lock); // except that we cannot access 
rq :/

> > +   if (!task_has_pi_waiters(p)) {
> > +           p->pi_top_task = NULL;
> > +           return;
> > +   }
> > +
> > +   p->pi_top_task = task_top_pi_waiter(p)->task;
> > +}
> > +
> >  /*
> >   * Calculate task priority from the waiter tree priority
> >   *
> > @@ -273,10 +283,7 @@ int rt_mutex_getprio(struct task_struct
> >  
> 
> Any specific locks that must be held when calling this?

#ifdef CONFIG_LOCKDEP
        WARN_ON_ONCE(debug_locks &&
                !lock_is_held(&p->pi_lock) &&
                !lock_is_held(&task_rq(p)->lock)); // again, cannot do this :/
#endif

> >  struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
> >  {
> > -   if (likely(!task_has_pi_waiters(task)))
> > -           return NULL;
> > -
> > -   return task_top_pi_waiter(task)->task;
> > +   return task->pi_top_task;
> >  }
> 
> -- Steve
> 

Reply via email to