aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2011-03-23 19:42:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-23 22:46:35 -0400
commit523fb486bfd94e3a3b16a42bcb21b1959cf14df8 (patch)
tree34c1b15a9bc55ef7a3bafb87cce3d3d184d78906 /kernel/cpuset.c
parentee24d3797780eee6ffe581a7b78d27896f9b494a (diff)
cpuset: hold callback_mutex in cpuset_post_clone()
Chaning cpuset->mems/cpuset->cpus should be protected under callback_mutex. cpuset_clone() doesn't follow this rule. It's ok because it's called when creating and initializing a cgroup, but we'd better hold the lock to avoid subtil break in the future. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Paul Menage <menage@google.com> Acked-by: David Rientjes <rientjes@google.com> Cc: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index e472fe13919..33eee16addb 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1840,8 +1840,10 @@ static void cpuset_post_clone(struct cgroup_subsys *ss,
1840 cs = cgroup_cs(cgroup); 1840 cs = cgroup_cs(cgroup);
1841 parent_cs = cgroup_cs(parent); 1841 parent_cs = cgroup_cs(parent);
1842 1842
1843 mutex_lock(&callback_mutex);
1843 cs->mems_allowed = parent_cs->mems_allowed; 1844 cs->mems_allowed = parent_cs->mems_allowed;
1844 cpumask_copy(cs->cpus_allowed, parent_cs->cpus_allowed); 1845 cpumask_copy(cs->cpus_allowed, parent_cs->cpus_allowed);
1846 mutex_unlock(&callback_mutex);
1845 return; 1847 return;
1846} 1848}
1847 1849