Skip to content

Commit

Permalink
memcg: fix memory.memsw.usage_in_bytes for root cgroup
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Daisuke Nishimura <[email protected]>
Acked-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
kiryl authored and torvalds committed Dec 16, 2009
1 parent 6be4b78 commit cd9b45b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cd9b45b

Please sign in to comment.