From: Max Krasnyansky Currently sched domains created by the cpusets are completely destroyed during CPU hotplug event handling. For each CPU hotplug event scheduler attaches all CPUs to the NULL domain and then puts them all into a single domain thereby destroying domains created by the cpusets. The solution is simple, when cpusets are enabled scheduler should not create the default domain and instead let cpusets rebuild the domains based on the current settings. Which is exactly what the patch does. Signed-off-by: Max Krasnyansky Cc: Ingo Molnar Cc: Paul Jackson Cc: Signed-off-by: Andrew Morton --- kernel/cpuset.c | 6 ++++++ kernel/sched.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff -puN kernel/cpuset.c~sched-cpu-hotplug-events-must-not-destroy-scheduler-domains-created-by-the-cpusets kernel/cpuset.c --- a/kernel/cpuset.c~sched-cpu-hotplug-events-must-not-destroy-scheduler-domains-created-by-the-cpusets +++ a/kernel/cpuset.c @@ -1890,6 +1890,12 @@ static void common_cpu_mem_hotplug_unplu top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY]; scan_for_empty_cpusets(&top_cpuset); + /* + * Scheduler destroys domains on hotplug events. + * Rebuild them based on the current settings. + */ + rebuild_sched_domains(); + cgroup_unlock(); } diff -puN kernel/sched.c~sched-cpu-hotplug-events-must-not-destroy-scheduler-domains-created-by-the-cpusets kernel/sched.c --- a/kernel/sched.c~sched-cpu-hotplug-events-must-not-destroy-scheduler-domains-created-by-the-cpusets +++ a/kernel/sched.c @@ -7537,8 +7537,16 @@ static int update_sched_domains(struct n return NOTIFY_DONE; } +#ifndef CONFIG_CPUSETS + /* + * Create default domain partitioning if cpusets are disabled. + * Otherwise we let cpusets rebuild the domains based on the + * current setup. + */ + /* The hotplug lock is already held by cpu_up/cpu_down */ arch_init_sched_domains(&cpu_online_map); +#endif return NOTIFY_OK; } _