diff options
author | Balaji Rao <balajirrao@gmail.com> | 2008-05-01 07:35:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-01 11:04:02 -0400 |
commit | 55e462b05b5df4fd113c4a304c4f487d44b0898e (patch) | |
tree | 0d538695cc0611395666194a6326b3ad424a9dc7 /mm | |
parent | f39e578172f30d3bdd4533465c7ec00db738eb9d (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')
-rw-r--r-- | mm/memcontrol.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 33add96cd5f..e46451e1d9b 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 | ||
204 | static struct mem_cgroup_per_zone * | 213 | static 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 | ||
889 | static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft, | 900 | static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft, |