Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1666093

[PATCH 1/4] cpuset/sched: cpuset makes sense for SMP only

From Nicolas Pitre <nicolas.pitre@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 1/4] cpuset/sched: cpuset makes sense for SMP only
Date 2017-06-14 19:30 +0200
Message-ID <tSkhc-85J-23@gated-at.bofh.it> (permalink)
References <tSk7v-80S-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Make CONFIG_CPUSETS depend on SMP as this feature makes no sense
on UP. This allows for configuring out cpuset_cpumask_can_shrink()
and task_can_attach() entirely.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
---
 init/Kconfig        | 1 +
 kernel/sched/core.c | 7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/init/Kconfig b/init/Kconfig
index 4ef946b466..b9aed60cac 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1156,6 +1156,7 @@ config CGROUP_HUGETLB
 
 config CPUSETS
 	bool "Cpuset controller"
+	depends on SMP
 	help
 	  This option will let you create and manage CPUSETs which
 	  allow dynamically partitioning a system into sets of CPUs and
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2a2c9c4fb3..94fa712791 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5463,6 +5463,8 @@ void init_idle(struct task_struct *idle, int cpu)
 #endif
 }
 
+#ifdef CONFIG_SMP
+
 int cpuset_cpumask_can_shrink(const struct cpumask *cur,
 			      const struct cpumask *trial)
 {
@@ -5506,7 +5508,6 @@ int task_can_attach(struct task_struct *p,
 		goto out;
 	}
 
-#ifdef CONFIG_SMP
 	if (dl_task(p) && !cpumask_intersects(task_rq(p)->rd->span,
 					      cs_cpus_allowed)) {
 		unsigned int dest_cpu = cpumask_any_and(cpu_active_mask,
@@ -5536,13 +5537,11 @@ int task_can_attach(struct task_struct *p,
 		rcu_read_unlock_sched();
 
 	}
-#endif
+
 out:
 	return ret;
 }
 
-#ifdef CONFIG_SMP
-
 bool sched_smp_initialized __read_mostly;
 
 #ifdef CONFIG_NUMA_BALANCING
-- 
2.9.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] some scheduler code movements and small cleanup Nicolas Pitre <nicolas.pitre@linaro.org> - 2017-06-14 19:20 +0200
  [PATCH 1/4] cpuset/sched: cpuset makes sense for SMP only Nicolas Pitre <nicolas.pitre@linaro.org> - 2017-06-14 19:30 +0200
  [PATCH 2/4] sched/deadline: move dl related code out of sched/core.c Nicolas Pitre <nicolas.pitre@linaro.org> - 2017-06-14 19:30 +0200
  [PATCH 3/4] sched/rt: move rt related code out of sched/core.c Nicolas Pitre <nicolas.pitre@linaro.org> - 2017-06-14 19:30 +0200

csiph-web