Skip to content

Commit 1f1562f

Browse files
Waiman-Longhtejun
authored andcommitted
cgroup/cpuset: Don't let child cpusets restrict parent in default hierarchy
In validate_change(), there is a check since v2.6.12 to make sure that each of the child cpusets must be a subset of a parent cpuset. IOW, it allows child cpusets to restrict what changes can be made to a parent's "cpuset.cpus". This actually violates one of the core principles of the default hierarchy where a cgroup higher up in the hierarchy should be able to change configuration however it sees fit as deligation breaks down otherwise. To address this issue, the check is now removed for the default hierarchy to free parent cpusets from being restricted by child cpusets. The check will still apply for legacy hierarchy. Suggested-by: Tejun Heo <[email protected]> Signed-off-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent e14da77 commit 1f1562f

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

kernel/cgroup/cpuset.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -616,19 +616,11 @@ static int validate_change(struct cpuset *cur, struct cpuset *trial)
616616
struct cpuset *c, *par;
617617
int ret;
618618

619-
rcu_read_lock();
620-
621-
/* Each of our child cpusets must be a subset of us */
622-
ret = -EBUSY;
623-
cpuset_for_each_child(c, css, cur)
624-
if (!is_cpuset_subset(c, trial))
625-
goto out;
626-
627-
/* Remaining checks don't apply to root cpuset */
628-
ret = 0;
619+
/* The checks don't apply to root cpuset */
629620
if (cur == &top_cpuset)
630-
goto out;
621+
return 0;
631622

623+
rcu_read_lock();
632624
par = parent_cs(cur);
633625

634626
/* On legacy hierarchy, we must be a subset of our parent cpuset. */

0 commit comments

Comments
 (0)