lkml.org 
[lkml]   [2011]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC][PATCH 3/5] memcg: Disable preemption in memcg_check_events()
From: Steven Rostedt <srostedt@redhat.com>

The code in memcg_check_events() calls this_cpu_read() on
different variables without disabling preemption, and can cause
the calculations to be done from two different CPU variables.

Disable preemption throughout the check to keep apples and oranges
from becoming a mixed drink.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Greg Thelen <gthelen@google.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
mm/memcontrol.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3508777..a164c93 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -718,6 +718,7 @@ static void __mem_cgroup_target_update(struct mem_cgroup *mem, int target)
*/
static void memcg_check_events(struct mem_cgroup *mem, struct page *page)
{
+ preempt_disable();
/* threshold event is triggered in finer grain than soft limit */
if (unlikely(__memcg_event_check(mem, MEM_CGROUP_TARGET_THRESH))) {
mem_cgroup_threshold(mem);
@@ -737,6 +738,7 @@ static void memcg_check_events(struct mem_cgroup *mem, struct page *page)
}
#endif
}
+ preempt_enable();
}

static struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont)
--
1.7.5.4



\
 
 \ /
  Last update: 2011-09-19 23:29    [W:0.163 / U:22.884 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site