aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorBalaji Rao <balajirrao@gmail.com>2008-05-01 07:35:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-01 11:04:02 -0400
commit55e462b05b5df4fd113c4a304c4f487d44b0898e (patch)
tree0d538695cc0611395666194a6326b3ad424a9dc7 /mm/memcontrol.c
parentf39e578172f30d3bdd4533465c7ec00db738eb9d (diff)
memcg: simple stats for memory resource controller
Implement trivial statistics for the memory resource controller. Signed-off-by: Balaji Rao <balajirrao@gmail.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Dhaval Giani <dhaval@linux.vnet.ibm.com> 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.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 33add96cd5fb..e46451e1d9b7 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -48,6 +48,8 @@ enum mem_cgroup_stat_index {
48 */ 48 */
49 MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */ 49 MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */
50 MEM_CGROUP_STAT_RSS, /* # of pages charged as rss */ 50 MEM_CGROUP_STAT_RSS, /* # of pages charged as rss */
51 MEM_CGROUP_STAT_PGPGIN_COUNT, /* # of pages paged in */
52 MEM_CGROUP_STAT_PGPGOUT_COUNT, /* # of pages paged out */
51 53
52 MEM_CGROUP_STAT_NSTATS, 54 MEM_CGROUP_STAT_NSTATS,
53}; 55};
@@ -199,6 +201,13 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *mem, int flags,
199 __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_CACHE, val); 201 __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_CACHE, val);
200 else 202 else
201 __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_RSS, val); 203 __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_RSS, val);
204
205 if (charge)
206 __mem_cgroup_stat_add_safe(stat,
207 MEM_CGROUP_STAT_PGPGIN_COUNT, 1);
208 else
209 __mem_cgroup_stat_add_safe(stat,
210 MEM_CGROUP_STAT_PGPGOUT_COUNT, 1);
202} 211}
203 212
204static struct mem_cgroup_per_zone * 213static struct mem_cgroup_per_zone *
@@ -884,6 +893,8 @@ static const struct mem_cgroup_stat_desc {
884} mem_cgroup_stat_desc[] = { 893} mem_cgroup_stat_desc[] = {
885 [MEM_CGROUP_STAT_CACHE] = { "cache", PAGE_SIZE, }, 894 [MEM_CGROUP_STAT_CACHE] = { "cache", PAGE_SIZE, },
886 [MEM_CGROUP_STAT_RSS] = { "rss", PAGE_SIZE, }, 895 [MEM_CGROUP_STAT_RSS] = { "rss", PAGE_SIZE, },
896 [MEM_CGROUP_STAT_PGPGIN_COUNT] = {"pgpgin", 1, },
897 [MEM_CGROUP_STAT_PGPGOUT_COUNT] = {"pgpgout", 1, },
887}; 898};
888 899
889static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft, 900static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft,