public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Wanpeng Li <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: torvalds@linux-foundation.org, wanpeng.li@linux.intel.com,
	hpa@zytor.com, linux-kernel@vger.kernel.org, juri.lelli@arm.com,
	peterz@infradead.org, tglx@linutronix.de,
	akpm@linux-foundation.org, mingo@kernel.org, bp@alien8.de
Subject: [tip:sched/core] sched/deadline: Reduce rq lock contention by eliminating locking of non-feasible target
Date: Fri, 19 Jun 2015 11:02:09 -0700	[thread overview]
Message-ID: <tip-9d514262425691dddf942edea8bc9919e66fe140@git.kernel.org> (raw)
In-Reply-To: <1431496867-4194-3-git-send-email-wanpeng.li@linux.intel.com>

Commit-ID:  9d514262425691dddf942edea8bc9919e66fe140
Gitweb:     http://git.kernel.org/tip/9d514262425691dddf942edea8bc9919e66fe140
Author:     Wanpeng Li <wanpeng.li@linux.intel.com>
AuthorDate: Wed, 13 May 2015 14:01:03 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 19 Jun 2015 10:06:46 +0200

sched/deadline: Reduce rq lock contention by eliminating locking of non-feasible target

This patch adds a check that prevents futile attempts to move DL tasks
to a CPU with active tasks of equal or earlier deadline. The same
behavior as commit 80e3d87b2c55 ("sched/rt: Reduce rq lock contention
by eliminating locking of non-feasible target") for rt class.

Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Juri Lelli <juri.lelli@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1431496867-4194-3-git-send-email-wanpeng.li@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 1c4bc31..98f7871 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1012,7 +1012,9 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags)
 	    (p->nr_cpus_allowed > 1)) {
 		int target = find_later_rq(p);
 
-		if (target != -1)
+		if (target != -1 &&
+				dl_time_before(p->dl.deadline,
+					cpu_rq(target)->dl.earliest_dl.curr))
 			cpu = target;
 	}
 	rcu_read_unlock();
@@ -1359,6 +1361,17 @@ static struct rq *find_lock_later_rq(struct task_struct *task, struct rq *rq)
 
 		later_rq = cpu_rq(cpu);
 
+		if (!dl_time_before(task->dl.deadline,
+					later_rq->dl.earliest_dl.curr)) {
+			/*
+			 * Target rq has tasks of equal or earlier deadline,
+			 * retrying does not release any lock and is unlikely
+			 * to yield a different result.
+			 */
+			later_rq = NULL;
+			break;
+		}
+
 		/* Retry if something changed. */
 		if (double_lock_balance(rq, later_rq)) {
 			if (unlikely(task_rq(task) != rq ||
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2015-06-19 18:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13  6:01 [PATCH v2 1/7] sched/deadline: fix try to pull pinned dl tasks in pull algorithm Wanpeng Li
2015-05-13  6:01 ` [PATCH v2 2/7] sched/deadline: make init_sched_dl_class() __init Wanpeng Li
2015-06-19 18:01   ` [tip:sched/core] sched/deadline: Make " tip-bot for Wanpeng Li
2015-05-13  6:01 ` [PATCH v2 3/7] sched/deadline: reduce rq lock contention by eliminating locking of non-feasible target Wanpeng Li
2015-06-19 18:02   ` tip-bot for Wanpeng Li [this message]
2015-05-13  6:01 ` [PATCH v2 4/7] sched/deadline: reschedule if stop task slip in after pull operations Wanpeng Li
2015-05-29 14:16   ` Peter Zijlstra
2015-05-31  0:06     ` Wanpeng Li
2015-05-13  6:01 ` [PATCH v2 5/7] sched/deadline: drop duplicate init_sched_dl_class declaration Wanpeng Li
2015-06-19 18:02   ` [tip:sched/core] sched/deadline: Drop duplicate init_sched_dl_class() declaration tip-bot for Wanpeng Li
2015-05-13  6:01 ` [PATCH v2 6/7] sched/core: remove superfluous resetting of dl_throttled flag Wanpeng Li
2015-06-19 18:02   ` [tip:sched/core] sched: Remove superfluous resetting of the p-> " tip-bot for Wanpeng Li
2015-05-13  6:01 ` [PATCH v2 7/7] sched/rt: reschedule if stop/dl task slip in after pull operations Wanpeng Li
2015-05-29 14:34   ` Peter Zijlstra
2015-05-31  0:15     ` Wanpeng Li
2015-05-19  0:23 ` [PATCH v2 1/7] sched/deadline: fix try to pull pinned dl tasks in pull algorithm Wanpeng Li
2015-05-26  2:17   ` Wanpeng Li
2015-06-19 18:01 ` [tip:sched/core] sched/deadline: Optimize pull_dl_task() tip-bot for Wanpeng 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-9d514262425691dddf942edea8bc9919e66fe140@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=juri.lelli@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=wanpeng.li@linux.intel.com \
    /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