[PATCH RT 05/25] rtmutex: No need to keep task ref for lock owner check

From: Steven Rostedt
Date: Fri Mar 13 2015 - 11:45:32 EST


3.2.68-rt99-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

upstream commit: 2ffa5a5cd2fe792b6399c903d5172adf088d8ff7

There is no point to keep the task ref across the check for lock
owner. Drop the ref before that, so the protection context is clear.

Found while documenting the chain walk.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Reviewed-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
Reviewed-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
kernel/rtmutex.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index a74c57a75269..7d338c8b23b9 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -407,6 +407,8 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,

/* Release the task */
raw_spin_unlock_irqrestore(&task->pi_lock, flags);
+ put_task_struct(task);
+
if (!rt_mutex_owner(lock)) {
struct rt_mutex_waiter *lock_top_waiter;

@@ -418,9 +420,8 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
if (top_waiter != lock_top_waiter)
rt_mutex_wake_waiter(lock_top_waiter);
raw_spin_unlock(&lock->wait_lock);
- goto out_put_task;
+ return 0;
}
- put_task_struct(task);

/* Grab the next task */
task = rt_mutex_owner(lock);
--
2.1.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/