Thread (4 messages) 4 messages, 1 author, 2011-02-24
DORMANTno replies REVIEWED: 3 (2M)

[PATCH v2 4/4] cpuset: Hold callback_mutex in cpuset_clone()

From: Li Zefan <hidden>
Date: 2011-02-24 06:56:08
Also in: lkml
Subsystem: the rest · Maintainer: Linus Torvalds

Chaning cpuset->mems/cpuset->cpus should be protected under
callback_mutex.

cpuset_post_clone() doesn't follow this rule. It's ok because it's
called when creating/initializing a cgroup, but we'd better
hold the lock to avoid subtil break in the future.

Acked-by: Paul Menage <redacted>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Li Zefan <redacted>
---
 kernel/cpuset.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 3f93e5a..1ca786a 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1836,8 +1836,10 @@ static void cpuset_post_clone(struct cgroup_subsys *ss,
 	cs = cgroup_cs(cgroup);
 	parent_cs = cgroup_cs(parent);
 
+	mutex_lock(&callback_mutex);
 	cs->mems_allowed = parent_cs->mems_allowed;
 	cpumask_copy(cs->cpus_allowed, parent_cs->cpus_allowed);
+	mutex_unlock(&callback_mutex);
 	return;
 }
 
-- 
1.7.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help