diff options
author | Greg Thelen <gthelen@google.com> | 2011-01-13 18:47:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 20:32:50 -0500 |
commit | 2a7106f2cb0768d00fe8c1eb42a754a7d8518f08 (patch) | |
tree | 730bef06e752c1edcb2d475fd193f94bea00bf6a /include/linux/memcontrol.h | |
parent | ece72400c2a27a3d726cb0854449f991d9fcd2da (diff) |
memcg: create extensible page stat update routines
Replace usage of the mem_cgroup_update_file_mapped() memcg
statistic update routine with two new routines:
* mem_cgroup_inc_page_stat()
* mem_cgroup_dec_page_stat()
As before, only the file_mapped statistic is managed. However, these more
general interfaces allow for new statistics to be more easily added. New
statistics are added with memcg dirty page accounting.
Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Andrea Righi <arighi@develer.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r-- | include/linux/memcontrol.h | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 159a0762aeaf..067115ce6b3e 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -25,6 +25,11 @@ struct page_cgroup; | |||
25 | struct page; | 25 | struct page; |
26 | struct mm_struct; | 26 | struct mm_struct; |
27 | 27 | ||
28 | /* Stats that can be updated by kernel. */ | ||
29 | enum mem_cgroup_page_stat_item { | ||
30 | MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */ | ||
31 | }; | ||
32 | |||
28 | extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | 33 | extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, |
29 | struct list_head *dst, | 34 | struct list_head *dst, |
30 | unsigned long *scanned, int order, | 35 | unsigned long *scanned, int order, |
@@ -121,7 +126,22 @@ static inline bool mem_cgroup_disabled(void) | |||
121 | return false; | 126 | return false; |
122 | } | 127 | } |
123 | 128 | ||
124 | void mem_cgroup_update_file_mapped(struct page *page, int val); | 129 | void mem_cgroup_update_page_stat(struct page *page, |
130 | enum mem_cgroup_page_stat_item idx, | ||
131 | int val); | ||
132 | |||
133 | static inline void mem_cgroup_inc_page_stat(struct page *page, | ||
134 | enum mem_cgroup_page_stat_item idx) | ||
135 | { | ||
136 | mem_cgroup_update_page_stat(page, idx, 1); | ||
137 | } | ||
138 | |||
139 | static inline void mem_cgroup_dec_page_stat(struct page *page, | ||
140 | enum mem_cgroup_page_stat_item idx) | ||
141 | { | ||
142 | mem_cgroup_update_page_stat(page, idx, -1); | ||
143 | } | ||
144 | |||
125 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, | 145 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, |
126 | gfp_t gfp_mask); | 146 | gfp_t gfp_mask); |
127 | u64 mem_cgroup_get_limit(struct mem_cgroup *mem); | 147 | u64 mem_cgroup_get_limit(struct mem_cgroup *mem); |
@@ -293,8 +313,13 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
293 | { | 313 | { |
294 | } | 314 | } |
295 | 315 | ||
296 | static inline void mem_cgroup_update_file_mapped(struct page *page, | 316 | static inline void mem_cgroup_inc_page_stat(struct page *page, |
297 | int val) | 317 | enum mem_cgroup_page_stat_item idx) |
318 | { | ||
319 | } | ||
320 | |||
321 | static inline void mem_cgroup_dec_page_stat(struct page *page, | ||
322 | enum mem_cgroup_page_stat_item idx) | ||
298 | { | 323 | { |
299 | } | 324 | } |
300 | 325 | ||