Thread (23 messages) 23 messages, 6 authors, 2013-08-05

Re: [PATCH V5 3/8] memcg: check for proper lock held in mem_cgroup_update_page_stat

From: Greg Thelen <hidden>
Date: 2013-08-04 18:48:20
Also in: linux-mm

On Thu, Aug 01 2013, Sha Zhengju wrote:
From: Sha Zhengju <redacted>

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
                                     ^^ Hocko
rcu_read_lock_held() because RCU is held if !mem_cgroup_disabled().

Signed-off-by: Sha Zhengju <redacted>
Reviewed-by: Greg Thelen <redacted>
quoted hunk ↗ jump to hunk
---
 mm/memcontrol.c |    1 +
 1 file changed, 1 insertion(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7691cef..4a55d46 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2301,6 +2301,7 @@ void mem_cgroup_update_page_stat(struct page *page,
 	if (mem_cgroup_disabled())
 		return;
 
+	VM_BUG_ON(!rcu_read_lock_held());
 	memcg = pc->mem_cgroup;
 	if (unlikely(!memcg || !PageCgroupUsed(pc)))
 		return;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help