aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-06-07 12:10:36 +0200
committerAnders Roxell <anders.roxell@linaro.org>2015-06-01 12:03:32 +0200
commit66147569ce90e0c4b9ce8b90e2dc7c37da999c6c (patch)
treec599f21d8cfc299be3feab05f0aacf1354e3a650
parenta18faca50a1b7d38c05d9238c4c19093ab0c6605 (diff)
downloadlinux-linaro-stable-66147569ce90e0c4b9ce8b90e2dc7c37da999c6c.tar.gz
rtmutex: No need to keep task ref for lock owner check
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@linutronix.de> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel/locking/rtmutex.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index e4cbd0cd5405..901a29345451 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -484,6 +484,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;
@@ -495,9 +497,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);