aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/cgroup.h3
-rw-r--r--kernel/cpuset.c9
2 files changed, 10 insertions, 2 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 53e81a61be57..74e8b8e4cd7f 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -281,6 +281,9 @@ enum {
281 * and take masks of ancestors with non-empty cpus/mems, instead of 281 * and take masks of ancestors with non-empty cpus/mems, instead of
282 * being moved to an ancestor. 282 * being moved to an ancestor.
283 * 283 *
284 * - cpuset: a task can be moved into an empty cpuset, and again it
285 * takes masks of ancestors.
286 *
284 * - memcg: use_hierarchy is on by default and the cgroup file for 287 * - memcg: use_hierarchy is on by default and the cgroup file for
285 * the flag is not created. 288 * the flag is not created.
286 * 289 *
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 3473dd2580d1..3b3fdfdd4d78 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -479,7 +479,7 @@ static int validate_change(const struct cpuset *cur, const struct cpuset *trial)
479 */ 479 */
480 ret = -ENOSPC; 480 ret = -ENOSPC;
481 if ((cgroup_task_count(cur->css.cgroup) || cur->attach_in_progress) && 481 if ((cgroup_task_count(cur->css.cgroup) || cur->attach_in_progress) &&
482 (cpumask_empty(trial->cpus_allowed) || 482 (cpumask_empty(trial->cpus_allowed) &&
483 nodes_empty(trial->mems_allowed))) 483 nodes_empty(trial->mems_allowed)))
484 goto out; 484 goto out;
485 485
@@ -1466,8 +1466,13 @@ static int cpuset_can_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
1466 1466
1467 mutex_lock(&cpuset_mutex); 1467 mutex_lock(&cpuset_mutex);
1468 1468
1469 /*
1470 * We allow to move tasks into an empty cpuset if sane_behavior
1471 * flag is set.
1472 */
1469 ret = -ENOSPC; 1473 ret = -ENOSPC;
1470 if (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)) 1474 if (!cgroup_sane_behavior(cgrp) &&
1475 (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)))
1471 goto out_unlock; 1476 goto out_unlock;
1472 1477
1473 cgroup_taskset_for_each(task, cgrp, tset) { 1478 cgroup_taskset_for_each(task, cgrp, tset) {