diff options
| author | Sha Zhengju <handai.szj@taobao.com> | 2013-09-12 18:13:50 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-12 18:38:02 -0400 |
| commit | 68b4876d996e8749142b2895bc2e251448996363 (patch) | |
| tree | bd21b2e160d48dc38b11869c1bef5d38100ddd98 /include/linux | |
| parent | 1a36e59d4833de19120dc7482c61ef69e228c73c (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 'include/linux')
| -rw-r--r-- | include/linux/memcontrol.h | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 89d576cfcc4c..f952a07ce7a9 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -30,9 +30,20 @@ struct page; | |||
| 30 | struct mm_struct; | 30 | struct mm_struct; |
| 31 | struct kmem_cache; | 31 | struct kmem_cache; |
| 32 | 32 | ||
| 33 | /* Stats that can be updated by kernel. */ | 33 | /* |
| 34 | enum mem_cgroup_page_stat_item { | 34 | * The corresponding mem_cgroup_stat_names is defined in mm/memcontrol.c, |
| 35 | MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */ | 35 | * These two lists should keep in accord with each other. |
| 36 | */ | ||
| 37 | enum mem_cgroup_stat_index { | ||
| 38 | /* | ||
| 39 | * For MEM_CONTAINER_TYPE_ALL, usage = pagecache + rss. | ||
| 40 | */ | ||
| 41 | MEM_CGROUP_STAT_CACHE, /* # of pages charged as cache */ | ||
| 42 | MEM_CGROUP_STAT_RSS, /* # of pages charged as anon rss */ | ||
| 43 | MEM_CGROUP_STAT_RSS_HUGE, /* # of pages charged as anon huge */ | ||
| 44 | MEM_CGROUP_STAT_FILE_MAPPED, /* # of pages charged as file rss */ | ||
| 45 | MEM_CGROUP_STAT_SWAP, /* # of pages, swapped out */ | ||
| 46 | MEM_CGROUP_STAT_NSTATS, | ||
| 36 | }; | 47 | }; |
| 37 | 48 | ||
| 38 | struct mem_cgroup_reclaim_cookie { | 49 | struct mem_cgroup_reclaim_cookie { |
| @@ -233,17 +244,17 @@ static inline void mem_cgroup_end_update_page_stat(struct page *page, | |||
| 233 | } | 244 | } |
| 234 | 245 | ||
| 235 | void mem_cgroup_update_page_stat(struct page *page, | 246 | void mem_cgroup_update_page_stat(struct page *page, |
| 236 | enum mem_cgroup_page_stat_item idx, | 247 | enum mem_cgroup_stat_index idx, |
| 237 | int val); | 248 | int val); |
| 238 | 249 | ||
| 239 | static inline void mem_cgroup_inc_page_stat(struct page *page, | 250 | static inline void mem_cgroup_inc_page_stat(struct page *page, |
| 240 | enum mem_cgroup_page_stat_item idx) | 251 | enum mem_cgroup_stat_index idx) |
| 241 | { | 252 | { |
| 242 | mem_cgroup_update_page_stat(page, idx, 1); | 253 | mem_cgroup_update_page_stat(page, idx, 1); |
| 243 | } | 254 | } |
| 244 | 255 | ||
| 245 | static inline void mem_cgroup_dec_page_stat(struct page *page, | 256 | static inline void mem_cgroup_dec_page_stat(struct page *page, |
| 246 | enum mem_cgroup_page_stat_item idx) | 257 | enum mem_cgroup_stat_index idx) |
| 247 | { | 258 | { |
| 248 | mem_cgroup_update_page_stat(page, idx, -1); | 259 | mem_cgroup_update_page_stat(page, idx, -1); |
| 249 | } | 260 | } |
| @@ -449,12 +460,12 @@ static inline bool mem_cgroup_oom_synchronize(void) | |||
| 449 | } | 460 | } |
| 450 | 461 | ||
| 451 | static inline void mem_cgroup_inc_page_stat(struct page *page, | 462 | static inline void mem_cgroup_inc_page_stat(struct page *page, |
| 452 | enum mem_cgroup_page_stat_item idx) | 463 | enum mem_cgroup_stat_index idx) |
| 453 | { | 464 | { |
| 454 | } | 465 | } |
| 455 | 466 | ||
| 456 | static inline void mem_cgroup_dec_page_stat(struct page *page, | 467 | static inline void mem_cgroup_dec_page_stat(struct page *page, |
| 457 | enum mem_cgroup_page_stat_item idx) | 468 | enum mem_cgroup_stat_index idx) |
| 458 | { | 469 | { |
| 459 | } | 470 | } |
| 460 | 471 | ||
