Skip to content

Commit e1d4eee

Browse files
Nicolas Pitreingomolnar
authored andcommitted
sched/cpuset: Only offer CONFIG_CPUSETS if SMP is enabled
Make CONFIG_CPUSETS=y 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, which shrinks the kernel a bit. Signed-off-by: Nicolas Pitre <nico@linaro.org> 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/20170614171926.8345-2-nicolas.pitre@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 387bc8b commit e1d4eee

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎init/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,7 @@ config CGROUP_HUGETLB
11561156

11571157
config CPUSETS
11581158
bool "Cpuset controller"
1159+
depends on SMP
11591160
help
11601161
This option will let you create and manage CPUSETs which
11611162
allow dynamically partitioning a system into sets of CPUs and

‎kernel/sched/core.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5451,6 +5451,8 @@ void init_idle(struct task_struct *idle, int cpu)
54515451
#endif
54525452
}
54535453

5454+
#ifdef CONFIG_SMP
5455+
54545456
int cpuset_cpumask_can_shrink(const struct cpumask *cur,
54555457
const struct cpumask *trial)
54565458
{
@@ -5494,7 +5496,6 @@ int task_can_attach(struct task_struct *p,
54945496
goto out;
54955497
}
54965498

5497-
#ifdef CONFIG_SMP
54985499
if (dl_task(p) && !cpumask_intersects(task_rq(p)->rd->span,
54995500
cs_cpus_allowed)) {
55005501
unsigned int dest_cpu = cpumask_any_and(cpu_active_mask,
@@ -5524,13 +5525,11 @@ int task_can_attach(struct task_struct *p,
55245525
rcu_read_unlock_sched();
55255526

55265527
}
5527-
#endif
5528+
55285529
out:
55295530
return ret;
55305531
}
55315532

5532-
#ifdef CONFIG_SMP
5533-
55345533
bool sched_smp_initialized __read_mostly;
55355534

55365535
#ifdef CONFIG_NUMA_BALANCING

0 commit comments

Comments
 (0)