aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2009-01-07 21:08:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 11:31:07 -0500
commitc9f299d9862deadf9fbee3ca28d915fdb006975a (patch)
tree2979e1eb8fe7e15369f01bcb405a029c18ca3e66 /mm
parent6e9015716ae9b59e9635d692fddfcfb9582c146c (diff)
mm: add zone nr_pages helper function
Add zone_nr_pages() helper function. It is used by a later patch. This patch doesn't have any functional change. Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Acked-by: Rik van Riel <riel@redhat.com> Cc: 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>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmscan.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 03ca923c6656..6827d35954fb 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -136,6 +136,13 @@ static struct zone_reclaim_stat *get_reclaim_stat(struct zone *zone,
136 return &zone->reclaim_stat; 136 return &zone->reclaim_stat;
137} 137}
138 138
139static unsigned long zone_nr_pages(struct zone *zone, struct scan_control *sc,
140 enum lru_list lru)
141{
142 return zone_page_state(zone, NR_LRU_BASE + lru);
143}
144
145
139/* 146/*
140 * Add a shrinker callback to be called from the vm 147 * Add a shrinker callback to be called from the vm
141 */ 148 */
@@ -1365,10 +1372,10 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc,
1365 return; 1372 return;
1366 } 1373 }
1367 1374
1368 anon = zone_page_state(zone, NR_ACTIVE_ANON) + 1375 anon = zone_nr_pages(zone, sc, LRU_ACTIVE_ANON) +
1369 zone_page_state(zone, NR_INACTIVE_ANON); 1376 zone_nr_pages(zone, sc, LRU_INACTIVE_ANON);
1370 file = zone_page_state(zone, NR_ACTIVE_FILE) + 1377 file = zone_nr_pages(zone, sc, LRU_ACTIVE_FILE) +
1371 zone_page_state(zone, NR_INACTIVE_FILE); 1378 zone_nr_pages(zone, sc, LRU_INACTIVE_FILE);
1372 free = zone_page_state(zone, NR_FREE_PAGES); 1379 free = zone_page_state(zone, NR_FREE_PAGES);
1373 1380
1374 /* If we have very few page cache pages, force-scan anon pages. */ 1381 /* If we have very few page cache pages, force-scan anon pages. */