]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
sched/core: Omit building stop_sched_class when !SMP
authorNicolas Pitre <nicolas.pitre@linaro.org>
Mon, 29 May 2017 21:02:57 +0000 (17:02 -0400)
committerIngo Molnar <mingo@kernel.org>
Thu, 8 Jun 2017 08:32:04 +0000 (10:32 +0200)
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
kernel/sched/core.c
kernel/sched/sched.h

index 89ab6758667bc12ee359cd2c4aab481a925b22fb..5e4c2e7a632bbb20b5c097a1851ff888d7d57e99 100644 (file)
@@ -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
index e5bd587e87f8e8671e160f07533b8a8704ce5667..c343b813577410e6b3d1b2847d49a5000aa32a51 100644 (file)
@@ -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,
index f1e400c6403cf9106618210cc63ddd44dae66314..f2ef759a4cb68082575782bbbf3ca6dabc46a4d3 100644 (file)
@@ -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)