mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Nicolas Pitre <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: torvalds@linux-foundation.org, nicolas.pitre@linaro.org,
	peterz@infradead.org, linux-kernel@vger.kernel.org,
	hpa@zytor.com, nico@linaro.org, tglx@linutronix.de,
	mingo@kernel.org, efault@gmx.de
Subject: [tip:sched/core] sched/core: Omit building stop_sched_class when !SMP
Date: Thu, 8 Jun 2017 02:30:53 -0700	[thread overview]
Message-ID: <tip-f5832c1998af2ca8d9947792d1c8e1816ab58e57@git.kernel.org> (raw)
In-Reply-To: <20170529210302.26868-3-nicolas.pitre@linaro.org>

Commit-ID:  f5832c1998af2ca8d9947792d1c8e1816ab58e57
Gitweb:     http://git.kernel.org/tip/f5832c1998af2ca8d9947792d1c8e1816ab58e57
Author:     Nicolas Pitre <nicolas.pitre@linaro.org>
AuthorDate: Mon, 29 May 2017 17:02:57 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 8 Jun 2017 10:32:04 +0200

sched/core: Omit building stop_sched_class when !SMP

The stop class is invoked through stop_machine only.
This is dead code on UP builds.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170529210302.26868-3-nicolas.pitre@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/Makefile |  4 ++--
 kernel/sched/core.c   | 60 +++++++++++++++++++++++++--------------------------
 kernel/sched/sched.h  |  4 ++++
 3 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile
index 89ab675..5e4c2e7 100644
--- a/kernel/sched/Makefile
+++ b/kernel/sched/Makefile
@@ -16,9 +16,9 @@ CFLAGS_core.o := $(PROFILING) -fno-omit-frame-pointer
 endif
 
 obj-y += core.o loadavg.o clock.o cputime.o
-obj-y += idle_task.o fair.o rt.o deadline.o stop_task.o
+obj-y += idle_task.o fair.o rt.o deadline.o
 obj-y += wait.o swait.o completion.o idle.o
-obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o topology.o
+obj-$(CONFIG_SMP) += cpupri.o cpudeadline.o topology.o stop_task.o
 obj-$(CONFIG_SCHED_AUTOGROUP) += autogroup.o
 obj-$(CONFIG_SCHEDSTATS) += stats.o
 obj-$(CONFIG_SCHED_DEBUG) += debug.o
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e5bd587..c343b81 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -788,36 +788,6 @@ void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
 	dequeue_task(rq, p, flags);
 }
 
-void sched_set_stop_task(int cpu, struct task_struct *stop)
-{
-	struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };
-	struct task_struct *old_stop = cpu_rq(cpu)->stop;
-
-	if (stop) {
-		/*
-		 * Make it appear like a SCHED_FIFO task, its something
-		 * userspace knows about and won't get confused about.
-		 *
-		 * Also, it will make PI more or less work without too
-		 * much confusion -- but then, stop work should not
-		 * rely on PI working anyway.
-		 */
-		sched_setscheduler_nocheck(stop, SCHED_FIFO, &param);
-
-		stop->sched_class = &stop_sched_class;
-	}
-
-	cpu_rq(cpu)->stop = stop;
-
-	if (old_stop) {
-		/*
-		 * Reset it back to a normal scheduling class so that
-		 * it can die in pieces.
-		 */
-		old_stop->sched_class = &rt_sched_class;
-	}
-}
-
 /*
  * __normal_prio - return the priority that is based on the static prio
  */
@@ -1588,6 +1558,36 @@ static void update_avg(u64 *avg, u64 sample)
 	*avg += diff >> 3;
 }
 
+void sched_set_stop_task(int cpu, struct task_struct *stop)
+{
+	struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };
+	struct task_struct *old_stop = cpu_rq(cpu)->stop;
+
+	if (stop) {
+		/*
+		 * Make it appear like a SCHED_FIFO task, its something
+		 * userspace knows about and won't get confused about.
+		 *
+		 * Also, it will make PI more or less work without too
+		 * much confusion -- but then, stop work should not
+		 * rely on PI working anyway.
+		 */
+		sched_setscheduler_nocheck(stop, SCHED_FIFO, &param);
+
+		stop->sched_class = &stop_sched_class;
+	}
+
+	cpu_rq(cpu)->stop = stop;
+
+	if (old_stop) {
+		/*
+		 * Reset it back to a normal scheduling class so that
+		 * it can die in pieces.
+		 */
+		old_stop->sched_class = &rt_sched_class;
+	}
+}
+
 #else
 
 static inline int __set_cpus_allowed_ptr(struct task_struct *p,
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index f1e400c..f2ef759a 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1453,7 +1453,11 @@ static inline void set_curr_task(struct rq *rq, struct task_struct *curr)
 	curr->sched_class->set_curr_task(rq);
 }
 
+#ifdef CONFIG_SMP
 #define sched_class_highest (&stop_sched_class)
+#else
+#define sched_class_highest (&dl_sched_class)
+#endif
 #define for_each_class(class) \
    for (class = sched_class_highest; class; class = class->next)
 

  reply	other threads:[~2017-06-08  9:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-29 21:02 [PATCH 0/7] scheduler tinification Nicolas Pitre
2017-05-29 21:02 ` [PATCH 1/7] cpuset/sched: cpuset makes sense for SMP only Nicolas Pitre
2017-05-29 21:02 ` [PATCH 2/7] sched: omit stop_sched_class when !SMP Nicolas Pitre
2017-06-08  9:30   ` tip-bot for Nicolas Pitre [this message]
2017-05-29 21:02 ` [PATCH 3/7] sched/deadline: move dl related code out of sched/core.c Nicolas Pitre
2017-05-29 21:02 ` [PATCH 4/7] sched/deadline: make it configurable Nicolas Pitre
2017-05-29 21:03 ` [PATCH 5/7] sched/rt: move rt related code out of sched/core.c Nicolas Pitre
2017-05-29 21:03 ` [PATCH 6/7] sched/rt: make it configurable Nicolas Pitre
2017-05-30  8:41   ` Peter Zijlstra
2017-05-30 12:17     ` Nicolas Pitre
2017-05-30 12:31       ` Peter Zijlstra
2017-05-31  2:18         ` Nicolas Pitre
2017-05-31  9:57         ` Daniel Bristot de Oliveira
2017-05-31 10:40           ` Peter Zijlstra
2017-05-31 16:06   ` [6/7] " Rob Herring
2017-05-31 16:25     ` Nicolas Pitre
2017-05-29 21:03 ` [PATCH 7/7] rtmutex: compatibility with CONFIG_SCHED_RT=n Nicolas Pitre
2017-05-30  8:32 ` [PATCH 0/7] scheduler tinification 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=tip-f5832c1998af2ca8d9947792d1c8e1816ab58e57@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=efault@gmx.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nico@linaro.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --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

Powered by JetHome