]> git.karo-electronics.de Git - linux-beck.git/commitdiff
rtmutex: No need to keep task ref for lock owner check
authorThomas Gleixner <tglx@linutronix.de>
Sat, 7 Jun 2014 10:10:36 +0000 (12:10 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 21 Jun 2014 20:05:30 +0000 (22:05 +0200)
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>
kernel/locking/rtmutex.c

index 39c9f8075e14d124eec475f1190dfdc64b06017e..cd517091fb21d4fa74a3a6247773f93dc72a28b3 100644 (file)
@@ -463,6 +463,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)) {
                /*
                 * 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,
                if (top_waiter != rt_mutex_top_waiter(lock))
                        wake_up_process(rt_mutex_top_waiter(lock)->task);
                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);