aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorSha Zhengju <handai.szj@taobao.com>2013-09-12 18:13:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-12 18:38:02 -0400
commit68b4876d996e8749142b2895bc2e251448996363 (patch)
treebd21b2e160d48dc38b11869c1bef5d38100ddd98 /mm/memcontrol.c
parent1a36e59d4833de19120dc7482c61ef69e228c73c (diff)
memcg: remove MEMCG_NR_FILE_MAPPED
While accounting memcg page stat, it's not worth to use MEMCG_NR_FILE_MAPPED as an extra layer of indirection because of the complexity and presumed performance overhead. We can use MEM_CGROUP_STAT_FILE_MAPPED directly. Signed-off-by: Sha Zhengju <handai.szj@taobao.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Michal Hocko <mhocko@suse.cz> Acked-by: Fengguang Wu <fengguang.wu@intel.com> Reviewed-by: Greg Thelen <gthelen@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> 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.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2c71f243186e..f3803462a7e6 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -84,21 +84,6 @@ static int really_do_swap_account __initdata = 0;
84#endif 84#endif
85 85
86 86
87/*
88 * Statistics for memory cgroup.
89 */
90enum mem_cgroup_stat_index {
91 /*
92 * For MEM_CONTAINER_TYPE_ALL, usage = pagecache + rss.
93 */
94 MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */
95 MEM_CGROUP_STAT_RSS, /* # of pages charged as anon rss */
96 MEM_CGROUP_STAT_RSS_HUGE, /* # of pages charged as anon huge */
97 MEM_CGROUP_STAT_FILE_MAPPED, /* # of pages charged as file rss */
98 MEM_CGROUP_STAT_SWAP, /* # of pages, swapped out */
99 MEM_CGROUP_STAT_NSTATS,
100};
101
102static const char * const mem_cgroup_stat_names[] = { 87static const char * const mem_cgroup_stat_names[] = {
103 "cache", 88 "cache",
104 "rss", 89 "rss",
@@ -2231,7 +2216,7 @@ void __mem_cgroup_end_update_page_stat(struct page *page, unsigned long *flags)
2231} 2216}
2232 2217
2233void mem_cgroup_update_page_stat(struct page *page, 2218void mem_cgroup_update_page_stat(struct page *page,
2234 enum mem_cgroup_page_stat_item idx, int val) 2219 enum mem_cgroup_stat_index idx, int val)
2235{ 2220{
2236 struct mem_cgroup *memcg; 2221 struct mem_cgroup *memcg;
2237 struct page_cgroup *pc = lookup_page_cgroup(page); 2222 struct page_cgroup *pc = lookup_page_cgroup(page);
@@ -2244,14 +2229,6 @@ void mem_cgroup_update_page_stat(struct page *page,
2244 if (unlikely(!memcg || !PageCgroupUsed(pc))) 2229 if (unlikely(!memcg || !PageCgroupUsed(pc)))
2245 return; 2230 return;
2246 2231
2247 switch (idx) {
2248 case MEMCG_NR_FILE_MAPPED:
2249 idx = MEM_CGROUP_STAT_FILE_MAPPED;
2250 break;
2251 default:
2252 BUG();
2253 }
2254
2255 this_cpu_add(memcg->stat->count[idx], val); 2232 this_cpu_add(memcg->stat->count[idx], val);
2256} 2233}
2257 2234