From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932187AbbCMPPV (ORCPT ); Fri, 13 Mar 2015 11:15:21 -0400 Received: from smtprelay0088.hostedemail.com ([216.40.44.88]:34818 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755881AbbCMPPS (ORCPT ); Fri, 13 Mar 2015 11:15:18 -0400 X-Session-Marker: 6E657665747340676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,,::::::::::::::::,RULES_HIT:355:379:871:988:989:1183:1260:1277:1312:1313:1314:1345:1516:1518:1519:1522:1534:1593:1594:1595:1596:1692:1730:1747:1777:1792:2392:2393:2559:2562:2828:3138:3139:3140:3141:3142:3876:3877:4411:5007:6114:6261:6642:6748:7281:7901:10004:10848:11604:11914:12517:12519:13895:14394:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: crook65_683c0474a054b X-Filterd-Recvd-Size: 2656 Message-Id: <20150313151515.716153490@goodmis.org> User-Agent: quilt/0.61-1 Date: Fri, 13 Mar 2015 11:14:59 -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/31] rtmutex: No need to keep task ref for lock owner check References: <20150313151454.809081378@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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.10.70-rt75-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 1052a337fa2c..eb748b542095 100644 --- a/kernel/rtmutex.c +++ b/kernel/rtmutex.c @@ -394,6 +394,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; @@ -405,9 +407,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