diff options
author | Zefan Li <lizefan@huawei.com> | 2015-02-12 22:19:49 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2015-03-02 11:55:04 -0500 |
commit | 790317e1b266c776765a4bdcedefea706ff0fada (patch) | |
tree | da14cf2e66b50ab59631292ba306e13fcc0f73e4 /kernel/cpuset.c | |
parent | c517d838eb7d07bbe9507871fab3931deccff539 (diff) |
cpuset: initialize effective masks when clone_children is enabled
If clone_children is enabled, effective masks won't be initialized
due to the bug:
# mount -t cgroup -o cpuset xxx /mnt
# echo 1 > cgroup.clone_children
# mkdir /mnt/tmp
# cat /mnt/tmp/
# cat cpuset.effective_cpus
# cat cpuset.cpus
0-15
And then this cpuset won't constrain the tasks in it.
Either the bug or the fix has no effect on unified hierarchy, as
there's no clone_chidren flag there any more.
Reported-by: Christian Brauner <christianvanbrauner@gmail.com>
Reported-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Cc: <stable@vger.kernel.org> # 3.17+
Signed-off-by: Zefan Li <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Tested-by: Serge Hallyn <serge.hallyn@canonical.com>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r-- | kernel/cpuset.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 1d1fe9361d29..89d4ed08afba 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1979,7 +1979,9 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) | |||
1979 | 1979 | ||
1980 | spin_lock_irq(&callback_lock); | 1980 | spin_lock_irq(&callback_lock); |
1981 | cs->mems_allowed = parent->mems_allowed; | 1981 | cs->mems_allowed = parent->mems_allowed; |
1982 | cs->effective_mems = parent->mems_allowed; | ||
1982 | cpumask_copy(cs->cpus_allowed, parent->cpus_allowed); | 1983 | cpumask_copy(cs->cpus_allowed, parent->cpus_allowed); |
1984 | cpumask_copy(cs->effective_cpus, parent->cpus_allowed); | ||
1983 | spin_unlock_irq(&callback_lock); | 1985 | spin_unlock_irq(&callback_lock); |
1984 | out_unlock: | 1986 | out_unlock: |
1985 | mutex_unlock(&cpuset_mutex); | 1987 | mutex_unlock(&cpuset_mutex); |