aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill@shutemov.name>2009-12-15 19:47:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 10:20:07 -0500
commitcd9b45b78a61e8df250e69385c74e729e5b66abf (patch)
tree8cb92363dd4b936814de9a0823016889b3441fde /mm/memcontrol.c
parent6be4b78993498c253e99b12c4d0f7684a36955e2 (diff)
memcg: fix memory.memsw.usage_in_bytes for root cgroup
A memory cgroup has a memory.memsw.usage_in_bytes file. It shows the sum of the usage of pages and swapents in the cgroup. Presently the root cgroup's memsw.usage_in_bytes shows the wrong value - the number of swapents are not added. So take MEM_CGROUP_STAT_SWAPOUT into account. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: <stable@kernel.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 e0c2066495e3..7b5b108c1c6b 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2542,6 +2542,7 @@ static u64 mem_cgroup_read(struct cgroup *cont, struct cftype *cft)
2542 val += idx_val; 2542 val += idx_val;
2543 mem_cgroup_get_recursive_idx_stat(mem, 2543 mem_cgroup_get_recursive_idx_stat(mem,
2544 MEM_CGROUP_STAT_SWAPOUT, &idx_val); 2544 MEM_CGROUP_STAT_SWAPOUT, &idx_val);
2545 val += idx_val;
2545 val <<= PAGE_SHIFT; 2546 val <<= PAGE_SHIFT;
2546 } else 2547 } else
2547 val = res_counter_read_u64(&mem->memsw, name); 2548 val = res_counter_read_u64(&mem->memsw, name);