Skip to content

Commit

Permalink
sched/cpuset: Only offer CONFIG_CPUSETS if SMP is enabled
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Nicolas Pitre authored and Ingo Molnar committed Jun 23, 2017
1 parent 387bc8b commit e1d4eee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5451,6 +5451,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)
{
Expand Down Expand Up @@ -5494,7 +5496,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,
Expand Down Expand Up @@ -5524,13 +5525,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
Expand Down

0 comments on commit e1d4eee

Please sign in to comment.