]> Git Repo - linux.git/commit
memcg: make mem_cgroup_read_stat() unsigned
authorGreg Thelen <[email protected]>
Thu, 1 Oct 2015 22:37:05 +0000 (15:37 -0700)
committerLinus Torvalds <[email protected]>
Fri, 2 Oct 2015 01:42:35 +0000 (21:42 -0400)
commit484ebb3b8c8b27dd2171696462a3116edb9ff801
tree1056eab0960e2ec868c6a5cfd3076d05ee5887a3
parent0610c25daa3e76e38ad5a8fae683a89ff9f71798
memcg: make mem_cgroup_read_stat() unsigned

mem_cgroup_read_stat() returns a page count by summing per cpu page
counters.  The summing is racy wrt.  updates, so a transient negative
sum is possible.  Callers don't want negative values:

 - mem_cgroup_wb_stats() doesn't want negative nr_dirty or nr_writeback.
   This could confuse dirty throttling.

 - oom reports and memory.stat shouldn't show confusing negative usage.

 - tree_usage() already avoids negatives.

Avoid returning negative page counts from mem_cgroup_read_stat() and
convert it to unsigned.

[[email protected]: fix old typo while we're in there]
Signed-off-by: Greg Thelen <[email protected]>
Cc: Johannes Weiner <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: <[email protected]> [4.2+]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/memcontrol.c
This page took 0.045058 seconds and 4 git commands to generate.