From: tip-bot for Tim Chen <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: suruchi.a.kadu@intel.com, linux-kernel@vger.kernel.org,
rostedt@goodmis.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
Subject: [tip:sched/core] sched/rt: Reduce rq lock contention by eliminating locking of non-feasible target
Date: Sun, 1 Feb 2015 09:52:24 -0800 [thread overview]
Message-ID: <tip-80e3d87b2c5582db0ab5e39610ce3707d97ba409@git.kernel.org> (raw)
In-Reply-To: <1421430374.2399.27.camel@schen9-desk2.jf.intel.com>
Commit-ID: 80e3d87b2c5582db0ab5e39610ce3707d97ba409
Gitweb: http://git.kernel.org/tip/80e3d87b2c5582db0ab5e39610ce3707d97ba409
Author: Tim Chen <tim.c.chen@linux.intel.com>
AuthorDate: Fri, 12 Dec 2014 15:38:12 -0800
Committer: Ingo Molnar <mingo@kernel.org>
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 <tim.c.chen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Shawn Bohrer <sbohrer@rgmadvisors.com>
Cc: Suruchi Kadu <suruchi.a.kadu@intel.com>
Cc: Doug Nelson<doug.nelson@intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1421430374.2399.27.camel@schen9-desk2.jf.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
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)) {
/*
next prev parent reply other threads:[~2015-02-01 17:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 19:01 [PATCH] Repost sched-rt: Reduce rq lock contention by eliminating locking of non-feasible target Tim Chen
2015-01-06 19:30 ` Peter Zijlstra
2015-01-15 17:13 ` Tim Chen
2015-01-16 1:58 ` Steven Rostedt
2015-01-16 17:46 ` Tim Chen
2015-01-22 17:48 ` Tim Chen
2015-02-01 17:52 ` tip-bot for Tim Chen [this message]
2015-02-24 16:12 ` [tip:sched/core] sched/rt: " Steven Rostedt
2015-03-03 21:12 ` Ben Hutchings
2015-04-09 1:17 ` Zefan Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-80e3d87b2c5582db0ab5e39610ce3707d97ba409@git.kernel.org \
--to=tipbot@zytor.com \
--cc=doug.nelson@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sbohrer@rgmadvisors.com \
--cc=suruchi.a.kadu@intel.com \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).