From: Kirill A. Shutemov Date: Wed, 16 Dec 2009 00:47:01 +0000 (-0800) Subject: memcg: fix memory.memsw.usage_in_bytes for root cgroup X-Git-Tag: v2.6.33-rc1~71^2~94 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=cd9b45b78a61e8df250e69385c74e729e5b66abf;p=karo-tx-linux.git 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 Reviewed-by: Daisuke Nishimura Acked-by: KAMEZAWA Hiroyuki Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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) val += idx_val; mem_cgroup_get_recursive_idx_stat(mem, MEM_CGROUP_STAT_SWAPOUT, &idx_val); + val += idx_val; val <<= PAGE_SHIFT; } else val = res_counter_read_u64(&mem->memsw, name);