linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Christoph Lameter <cl@linux.com>,
	Kevin Hilman <khilman@linaro.org>,
	Mike Galbraith <bitbucket@online.de>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: [PATCH] sched,nohz: fallback to housekeeping cpus before fallback to possible cpus
Date: Wed, 1 Apr 2015 17:06:12 +0800	[thread overview]
Message-ID: <1427879172-22711-1-git-send-email-laijs@cn.fujitsu.com> (raw)

Let the processes which lose they original cpus run on housekeeping cpus
if they can to reduce disturbances on nohz_full cpus.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Christoph Lameter <cl@linux.com>
Cc: Kevin Hilman <khilman@linaro.org>
Cc: Mike Galbraith <bitbucket@online.de>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 kernel/sched/core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f0f831e..f9ef41a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1286,7 +1286,7 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
 {
 	int nid = cpu_to_node(cpu);
 	const struct cpumask *nodemask = NULL;
-	enum { cpuset, possible, fail } state = cpuset;
+	enum { cpuset, housekeeping, possible, fail } state = cpuset;
 	int dest_cpu;
 
 	/*
@@ -1322,8 +1322,15 @@ static int select_fallback_rq(int cpu, struct task_struct *p)
 		case cpuset:
 			/* No more Mr. Nice Guy. */
 			cpuset_cpus_allowed_fallback(p);
+			state = housekeeping;
+			break;
+
+		case housekeeping:
+#ifdef CONFIG_NO_HZ_FULL
+			do_set_cpus_allowed(p, housekeeping_mask);
 			state = possible;
 			break;
+# endif /* CONFIG_NO_HZ_FULL. Fallthrough when !CONFIG_NO_HZ_FULL */
 
 		case possible:
 			do_set_cpus_allowed(p, cpu_possible_mask);
-- 
2.1.0


             reply	other threads:[~2015-04-01  9:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01  9:06 Lai Jiangshan [this message]
2015-04-01 11:59 ` [PATCH] sched,nohz: fallback to housekeeping cpus before fallback to possible cpus Peter Zijlstra

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=1427879172-22711-1-git-send-email-laijs@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=bitbucket@online.de \
    --cc=cl@linux.com \
    --cc=fweisbec@gmail.com \
    --cc=khilman@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=viresh.kumar@linaro.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).