aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2009-01-07 21:08:19 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 11:31:08 -0500
commita3d8e0549d913e30968fa02e505dfe02c0a23e0d (patch)
treee4d3df33666a18614289ae7bc76c27ad7950eb73
parent14797e2363c2b2f1ce139fd1c5a215e4e05aa1d9 (diff)
memcg: add mem_cgroup_zone_nr_pages()
Introduce mem_cgroup_zone_nr_pages(). It is called by zone_nr_pages() helper function. This patch doesn't have any behavior change. Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Acked-by: Balbir Singh <balbir@in.ibm.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: Hugh Dickins <hugh@veritas.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/memcontrol.h11
-rw-r--r--mm/memcontrol.c12
-rw-r--r--mm/vmscan.c3
3 files changed, 25 insertions, 1 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index aad9377c9828..b1defd6a2783 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -102,6 +102,9 @@ extern long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, struct zone *zone,
102 int priority, enum lru_list lru); 102 int priority, enum lru_list lru);
103int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, 103int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg,
104 struct zone *zone); 104 struct zone *zone);
105unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
106 struct zone *zone,
107 enum lru_list lru);
105 108
106#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 109#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
107extern int do_swap_account; 110extern int do_swap_account;
@@ -260,6 +263,14 @@ mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *zone)
260 return 1; 263 return 1;
261} 264}
262 265
266static inline unsigned long
267mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone,
268 enum lru_list lru)
269{
270 return 0;
271}
272
273
263#endif /* CONFIG_CGROUP_MEM_CONT */ 274#endif /* CONFIG_CGROUP_MEM_CONT */
264 275
265#endif /* _LINUX_MEMCONTROL_H */ 276#endif /* _LINUX_MEMCONTROL_H */
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6611328460e9..313247e6c503 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -186,7 +186,6 @@ pcg_default_flags[NR_CHARGE_TYPE] = {
186 0, /* FORCE */ 186 0, /* FORCE */
187}; 187};
188 188
189
190/* for encoding cft->private value on file */ 189/* for encoding cft->private value on file */
191#define _MEM (0) 190#define _MEM (0)
192#define _MEMSWAP (1) 191#define _MEMSWAP (1)
@@ -448,6 +447,17 @@ int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *zone)
448 return 0; 447 return 0;
449} 448}
450 449
450unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
451 struct zone *zone,
452 enum lru_list lru)
453{
454 int nid = zone->zone_pgdat->node_id;
455 int zid = zone_idx(zone);
456 struct mem_cgroup_per_zone *mz = mem_cgroup_zoneinfo(memcg, nid, zid);
457
458 return MEM_CGROUP_ZSTAT(mz, lru);
459}
460
451unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 461unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
452 struct list_head *dst, 462 struct list_head *dst,
453 unsigned long *scanned, int order, 463 unsigned long *scanned, int order,
diff --git a/mm/vmscan.c b/mm/vmscan.c
index b2bc06bffcfb..d958d624d3ae 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -139,6 +139,9 @@ static struct zone_reclaim_stat *get_reclaim_stat(struct zone *zone,
139static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc, 139static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc,
140 enum lru_list lru) 140 enum lru_list lru)
141{ 141{
142 if (!scan_global_lru(sc))
143 return mem_cgroup_zone_nr_pages(sc->mem_cgroup, zone, lru);
144
142 return zone_page_state(zone, NR_LRU_BASE + lru); 145 return zone_page_state(zone, NR_LRU_BASE + lru);
143} 146}
144 147