aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorSha Zhengju <handai.szj@taobao.com>2013-09-12 18:13:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-12 18:38:02 -0400
commit658b72c5a7a033f0dde61b15dff86bf423ce425e (patch)
tree271352bf3a3c5ad13acca1ca425dfb8b53d1e190 /mm/memcontrol.c
parent68b4876d996e8749142b2895bc2e251448996363 (diff)
memcg: check for proper lock held in mem_cgroup_update_page_stat
We should call mem_cgroup_begin_update_page_stat() before mem_cgroup_update_page_stat() to get proper locks, however the latter doesn't do any checking that we use proper locking, which would be hard. Suggested by Michal Hock we could at least test for rcu_read_lock_held() because RCU is held if !mem_cgroup_disabled(). Signed-off-by: Sha Zhengju <handai.szj@taobao.com> Acked-by: Michal Hocko <mhocko@suse.cz> Reviewed-by: Greg Thelen <gthelen@google.com> Cc: Fengguang Wu <fengguang.wu@intel.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f3803462a7e6..0093bc36c5fc 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2225,6 +2225,7 @@ void mem_cgroup_update_page_stat(struct page *page,
2225 if (mem_cgroup_disabled()) 2225 if (mem_cgroup_disabled())
2226 return; 2226 return;
2227 2227
2228 VM_BUG_ON(!rcu_read_lock_held());
2228 memcg = pc->mem_cgroup; 2229 memcg = pc->mem_cgroup;
2229 if (unlikely(!memcg || !PageCgroupUsed(pc))) 2230 if (unlikely(!memcg || !PageCgroupUsed(pc)))
2230 return; 2231 return;