From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756231AbbCLTgy (ORCPT ); Thu, 12 Mar 2015 15:36:54 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.226]:11725 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755764AbbCLTV5 (ORCPT ); Thu, 12 Mar 2015 15:21:57 -0400 Message-Id: <20150312192155.278519340@goodmis.org> User-Agent: quilt/0.61-1 Date: Thu, 12 Mar 2015 15:21:44 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-rt-users Cc: Thomas Gleixner , Carsten Emde , Sebastian Andrzej Siewior , John Kacur , Paul Gortmaker , Lai Jiangshan Subject: [PATCH RT 05/36] rtmutex: No need to keep task ref for lock owner check References: <20150312192139.799127123@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=0005-rtmutex-No-need-to-keep-task-ref-for-lock-owner-chec.patch X-RR-Connecting-IP: 107.14.168.130:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.12.38-rt53-rc1 stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner 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 Reviewed-by: Steven Rostedt Reviewed-by: Lai Jiangshan Signed-off-by: Steven Rostedt --- kernel/rtmutex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c index 27420e448a9f..7a089565d869 100644 --- a/kernel/rtmutex.c +++ b/kernel/rtmutex.c @@ -410,6 +410,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; @@ -421,9 +423,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