From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753113AbbBXQMy (ORCPT ); Tue, 24 Feb 2015 11:12:54 -0500 Received: from smtprelay0094.hostedemail.com ([216.40.44.94]:36148 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753085AbbBXQMw (ORCPT ); Tue, 24 Feb 2015 11:12:52 -0500 X-Session-Marker: 6E657665747340676F6F646D69732E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,,::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:617:800:960:967:973:988:989:1260:1263:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2525:2553:2561:2564:2682:2685:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4362:5007:6119:6261:6742:7875:7901:7903:8599:8957:9025:9388:10004:10400:10471:10848:10913:10967:11026:11232:11257:11473:11658:11914:12043:12266:12296:12438:12517:12519:12555:12740:12783:13255:14096:14097:21060: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: crown23_358db1ebe854e X-Filterd-Recvd-Size: 3976 Date: Tue, 24 Feb 2015 11:12:47 -0500 From: Steven Rostedt To: tip-bot for Tim Chen Cc: suruchi.a.kadu@intel.com, linux-kernel@vger.kernel.org, sbohrer@rgmadvisors.com, peterz@infradead.org, mingo@kernel.org, tglx@linutronix.de, doug.nelson@intel.com, torvalds@linux-foundation.org, tim.c.chen@linux.intel.com, hpa@zytor.com, stable@vger.kernel.org, Clark Williams Subject: Re: [tip:sched/core] sched/rt: Reduce rq lock contention by eliminating locking of non-feasible target Message-ID: <20150224111247.2ca122c3@gandalf.local.home> In-Reply-To: References: <1421430374.2399.27.camel@schen9-desk2.jf.intel.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 1 Feb 2015 09:52:24 -0800 tip-bot for Tim Chen wrote: > Commit-ID: 80e3d87b2c5582db0ab5e39610ce3707d97ba409 > Gitweb: http://git.kernel.org/tip/80e3d87b2c5582db0ab5e39610ce3707d97ba409 > Author: Tim Chen > AuthorDate: Fri, 12 Dec 2014 15:38:12 -0800 > Committer: Ingo Molnar > CommitDate: Fri, 30 Jan 2015 19:38:49 +0100 > > sched/rt: Reduce rq lock contention by eliminating locking of non-feasible target > > This patch adds checks that prevens futile attempts to move rt tasks > to a CPU with active tasks of equal or higher priority. > > This reduces run queue lock contention and improves the performance of > a well known OLTP benchmark by 0.7%. > > Signed-off-by: Tim Chen > Signed-off-by: Peter Zijlstra (Intel) > Cc: Shawn Bohrer > Cc: Suruchi Kadu > Cc: Doug Nelson > Cc: Steven Rostedt > Cc: Linus Torvalds > Link: http://lkml.kernel.org/r/1421430374.2399.27.camel@schen9-desk2.jf.intel.com > Signed-off-by: Ingo Molnar I see this has been added to mainline already. I think this should go to stable as well. As far back as it applies. I'll even add this to the stable-rt if need be. But I rather pull it into stable-rt via the stable branches. Thanks, -- Steve > --- > kernel/sched/rt.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > index 6725e3c..f4d4b07 100644 > --- a/kernel/sched/rt.c > +++ b/kernel/sched/rt.c > @@ -1340,7 +1340,12 @@ select_task_rq_rt(struct task_struct *p, int cpu, int sd_flag, int flags) > curr->prio <= p->prio)) { > int target = find_lowest_rq(p); > > - if (target != -1) > + /* > + * Don't bother moving it if the destination CPU is > + * not running a lower priority task. > + */ > + if (target != -1 && > + p->prio < cpu_rq(target)->rt.highest_prio.curr) > cpu = target; > } > rcu_read_unlock(); > @@ -1617,6 +1622,16 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq) > > lowest_rq = cpu_rq(cpu); > > + if (lowest_rq->rt.highest_prio.curr <= task->prio) { > + /* > + * Target rq has tasks of equal or higher priority, > + * retrying does not release any lock and is unlikely > + * to yield a different result. > + */ > + lowest_rq = NULL; > + break; > + } > + > /* if the prio of this runqueue changed, try again */ > if (double_lock_balance(rq, lowest_rq)) { > /*