aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/locking
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-06-07 06:10:36 -0400
committerThomas Gleixner <tglx@linutronix.de>2014-06-21 16:05:30 -0400
commit2ffa5a5cd2fe792b6399c903d5172adf088d8ff7 (patch)
treeb73baebd96860c39bda9cd8dd91b01bae2e06770 /kernel/locking
parent358c331f391f3e0432f4f96f25017d12ac8d10b1 (diff)
rtmutex: No need to keep task ref for lock owner check
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>
Diffstat (limited to 'kernel/locking')
-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 39c9f8075e14..cd517091fb21 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -463,6 +463,8 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
463 463
464 /* Release the task */ 464 /* Release the task */
465 raw_spin_unlock_irqrestore(&task->pi_lock, flags); 465 raw_spin_unlock_irqrestore(&task->pi_lock, flags);
466 put_task_struct(task);
467
466 if (!rt_mutex_owner(lock)) { 468 if (!rt_mutex_owner(lock)) {
467 /* 469 /*
468 * If the requeue above changed the top waiter, then we need 470 * If the requeue above changed the top waiter, then we need
@@ -472,9 +474,8 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
472 if (top_waiter != rt_mutex_top_waiter(lock)) 474 if (top_waiter != rt_mutex_top_waiter(lock))
473 wake_up_process(rt_mutex_top_waiter(lock)->task); 475 wake_up_process(rt_mutex_top_waiter(lock)->task);
474 raw_spin_unlock(&lock->wait_lock); 476 raw_spin_unlock(&lock->wait_lock);
475 goto out_put_task; 477 return 0;
476 } 478 }
477 put_task_struct(task);
478 479
479 /* Grab the next task */ 480 /* Grab the next task */
480 task = rt_mutex_owner(lock); 481 task = rt_mutex_owner(lock);