Re: [PATCH -v2 2/9] sched/rtmutex/deadline: Fix a PI crash for deadline tasks

From: Steven Rostedt
Date: Mon Sep 26 2016 - 11:21:20 EST


> --- 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.

> +void rt_mutex_update_top_task(struct task_struct *p)
> +{
> + 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?

> 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