aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memcontrol.h
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2009-01-07 21:08:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 11:31:06 -0500
commit2e4d40915fb85207fe48cfc31201824ec6d7426e (patch)
tree60f4a8ce1278a861ff530885353da74d1cf0bdb4 /include/linux/memcontrol.h
parent18f59ea7de08db2449ba99185e8d8cc30e7acac5 (diff)
memcontrol: rcu_read_lock() to protect mm_match_cgroup()
mm_match_cgroup() calls cgroup_subsys_state(). We must use rcu_read_lock() to protect cgroup_subsys_state(). Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Paul Menage <menage@google.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Pavel Emelyanov <xemul@openvz.org> Cc: Balbir Singh <balbir@in.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r--include/linux/memcontrol.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 472efd09118c..2de6504e01fb 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -61,8 +61,15 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
61 61
62extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 62extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
63 63
64#define mm_match_cgroup(mm, cgroup) \ 64static inline
65 ((cgroup) == mem_cgroup_from_task((mm)->owner)) 65int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
66{
67 struct mem_cgroup *mem;
68 rcu_read_lock();
69 mem = mem_cgroup_from_task((mm)->owner);
70 rcu_read_unlock();
71 return cgroup == mem;
72}
66 73
67extern int 74extern int
68mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr); 75mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr);