aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memcontrol.h
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2011-07-26 19:08:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-26 19:49:42 -0400
commitbb2a0de92c891b8feeedc0178acb3ae009d899a8 (patch)
treec2c0b3ad66c8da0e48c021927b2d747fb08b7ef3 /include/linux/memcontrol.h
parent1f4c025b5a5520fd2571244196b1b01ad96d18f6 (diff)
memcg: consolidate memory cgroup lru stat functions
In mm/memcontrol.c, there are many lru stat functions as.. mem_cgroup_zone_nr_lru_pages mem_cgroup_node_nr_file_lru_pages mem_cgroup_nr_file_lru_pages mem_cgroup_node_nr_anon_lru_pages mem_cgroup_nr_anon_lru_pages mem_cgroup_node_nr_unevictable_lru_pages mem_cgroup_nr_unevictable_lru_pages mem_cgroup_node_nr_lru_pages mem_cgroup_nr_lru_pages mem_cgroup_get_local_zonestat Some of them are under #ifdef MAX_NUMNODES >1 and others are not. This seems bad. This patch consolidates all functions into mem_cgroup_zone_nr_lru_pages() mem_cgroup_node_nr_lru_pages() mem_cgroup_nr_lru_pages() For these functions, "which LRU?" information is passed by a mask. example: mem_cgroup_nr_lru_pages(mem, BIT(LRU_ACTIVE_ANON)) And I added some macro as ALL_LRU, ALL_LRU_FILE, ALL_LRU_ANON. example: mem_cgroup_nr_lru_pages(mem, ALL_LRU) BTW, considering layout of NUMA memory placement of counters, this patch seems to be better. Now, when we gather all LRU information, we scan in following orer for_each_lru -> for_each_node -> for_each_zone. This means we'll touch cache lines in different node in turn. After patch, we'll scan for_each_node -> for_each_zone -> for_each_lru(mask) Then, we'll gather information in the same cacheline at once. [akpm@linux-foundation.org: fix warnigns, build error] Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: Balbir Singh <bsingharora@gmail.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Ying Han <yinghan@google.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.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 50940da6adf3..affd5b19b86c 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -111,8 +111,7 @@ int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
111int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg); 111int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg);
112int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); 112int mem_cgroup_select_victim_node(struct mem_cgroup *memcg);
113unsigned long mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, 113unsigned long mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg,
114 struct zone *zone, 114 int nid, int zid, unsigned int lrumask);
115 enum lru_list lru);
116struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, 115struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
117 struct zone *zone); 116 struct zone *zone);
118struct zone_reclaim_stat* 117struct zone_reclaim_stat*
@@ -313,8 +312,8 @@ mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg)
313} 312}
314 313
315static inline unsigned long 314static inline unsigned long
316mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, struct zone *zone, 315mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, int nid, int zid,
317 enum lru_list lru) 316 unsigned int lru_mask)
318{ 317{
319 return 0; 318 return 0;
320} 319}