aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@openvz.org>2012-05-29 18:07:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:26 -0400
commit1a93be0e7a6fc7f3d19101402665c7a958beb568 (patch)
treeaf2988851801b6e5d04d3e3f6d5c2932d75ff08a /mm
parentc56d5c7dfeb5cc754e17fa3d423086a3c551c219 (diff)
mm/vmscan: push lruvec pointer into shrink_list()
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Mel Gorman <mel@csn.ul.ie> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Hugh Dickins <hughd@google.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.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 79e2ead21c57..6dbf2c2082e7 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1205,7 +1205,7 @@ putback_inactive_pages(struct lruvec *lruvec,
1205 * of reclaimed pages 1205 * of reclaimed pages
1206 */ 1206 */
1207static noinline_for_stack unsigned long 1207static noinline_for_stack unsigned long
1208shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz, 1208shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
1209 struct scan_control *sc, enum lru_list lru) 1209 struct scan_control *sc, enum lru_list lru)
1210{ 1210{
1211 LIST_HEAD(page_list); 1211 LIST_HEAD(page_list);
@@ -1216,9 +1216,8 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,
1216 unsigned long nr_writeback = 0; 1216 unsigned long nr_writeback = 0;
1217 isolate_mode_t isolate_mode = 0; 1217 isolate_mode_t isolate_mode = 0;
1218 int file = is_file_lru(lru); 1218 int file = is_file_lru(lru);
1219 struct zone *zone = mz->zone; 1219 struct zone *zone = lruvec_zone(lruvec);
1220 struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(mz); 1220 struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
1221 struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, mz->mem_cgroup);
1222 1221
1223 while (unlikely(too_many_isolated(zone, file, sc))) { 1222 while (unlikely(too_many_isolated(zone, file, sc))) {
1224 congestion_wait(BLK_RW_ASYNC, HZ/10); 1223 congestion_wait(BLK_RW_ASYNC, HZ/10);
@@ -1373,7 +1372,7 @@ static void move_active_pages_to_lru(struct zone *zone,
1373} 1372}
1374 1373
1375static void shrink_active_list(unsigned long nr_to_scan, 1374static void shrink_active_list(unsigned long nr_to_scan,
1376 struct mem_cgroup_zone *mz, 1375 struct lruvec *lruvec,
1377 struct scan_control *sc, 1376 struct scan_control *sc,
1378 enum lru_list lru) 1377 enum lru_list lru)
1379{ 1378{
@@ -1384,12 +1383,11 @@ static void shrink_active_list(unsigned long nr_to_scan,
1384 LIST_HEAD(l_active); 1383 LIST_HEAD(l_active);
1385 LIST_HEAD(l_inactive); 1384 LIST_HEAD(l_inactive);
1386 struct page *page; 1385 struct page *page;
1387 struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(mz); 1386 struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
1388 unsigned long nr_rotated = 0; 1387 unsigned long nr_rotated = 0;
1389 isolate_mode_t isolate_mode = 0; 1388 isolate_mode_t isolate_mode = 0;
1390 int file = is_file_lru(lru); 1389 int file = is_file_lru(lru);
1391 struct zone *zone = mz->zone; 1390 struct zone *zone = lruvec_zone(lruvec);
1392 struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, mz->mem_cgroup);
1393 1391
1394 lru_add_drain(); 1392 lru_add_drain();
1395 1393
@@ -1555,21 +1553,17 @@ static int inactive_list_is_low(struct lruvec *lruvec, int file)
1555} 1553}
1556 1554
1557static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan, 1555static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
1558 struct mem_cgroup_zone *mz, 1556 struct lruvec *lruvec, struct scan_control *sc)
1559 struct scan_control *sc)
1560{ 1557{
1561 int file = is_file_lru(lru); 1558 int file = is_file_lru(lru);
1562 1559
1563 if (is_active_lru(lru)) { 1560 if (is_active_lru(lru)) {
1564 struct lruvec *lruvec = mem_cgroup_zone_lruvec(mz->zone,
1565 mz->mem_cgroup);
1566
1567 if (inactive_list_is_low(lruvec, file)) 1561 if (inactive_list_is_low(lruvec, file))
1568 shrink_active_list(nr_to_scan, mz, sc, lru); 1562 shrink_active_list(nr_to_scan, lruvec, sc, lru);
1569 return 0; 1563 return 0;
1570 } 1564 }
1571 1565
1572 return shrink_inactive_list(nr_to_scan, mz, sc, lru); 1566 return shrink_inactive_list(nr_to_scan, lruvec, sc, lru);
1573} 1567}
1574 1568
1575static int vmscan_swappiness(struct scan_control *sc) 1569static int vmscan_swappiness(struct scan_control *sc)
@@ -1812,7 +1806,7 @@ restart:
1812 nr[lru] -= nr_to_scan; 1806 nr[lru] -= nr_to_scan;
1813 1807
1814 nr_reclaimed += shrink_list(lru, nr_to_scan, 1808 nr_reclaimed += shrink_list(lru, nr_to_scan,
1815 mz, sc); 1809 lruvec, sc);
1816 } 1810 }
1817 } 1811 }
1818 /* 1812 /*
@@ -1835,7 +1829,7 @@ restart:
1835 * rebalance the anon lru active/inactive ratio. 1829 * rebalance the anon lru active/inactive ratio.
1836 */ 1830 */
1837 if (inactive_anon_is_low(lruvec)) 1831 if (inactive_anon_is_low(lruvec))
1838 shrink_active_list(SWAP_CLUSTER_MAX, mz, 1832 shrink_active_list(SWAP_CLUSTER_MAX, lruvec,
1839 sc, LRU_ACTIVE_ANON); 1833 sc, LRU_ACTIVE_ANON);
1840 1834
1841 /* reclaim/compaction might need reclaim to continue */ 1835 /* reclaim/compaction might need reclaim to continue */
@@ -2268,13 +2262,9 @@ static void age_active_anon(struct zone *zone, struct scan_control *sc)
2268 memcg = mem_cgroup_iter(NULL, NULL, NULL); 2262 memcg = mem_cgroup_iter(NULL, NULL, NULL);
2269 do { 2263 do {
2270 struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg); 2264 struct lruvec *lruvec = mem_cgroup_zone_lruvec(zone, memcg);
2271 struct mem_cgroup_zone mz = {
2272 .mem_cgroup = memcg,
2273 .zone = zone,
2274 };
2275 2265
2276 if (inactive_anon_is_low(lruvec)) 2266 if (inactive_anon_is_low(lruvec))
2277 shrink_active_list(SWAP_CLUSTER_MAX, &mz, 2267 shrink_active_list(SWAP_CLUSTER_MAX, lruvec,
2278 sc, LRU_ACTIVE_ANON); 2268 sc, LRU_ACTIVE_ANON);
2279 2269
2280 memcg = mem_cgroup_iter(NULL, memcg, NULL); 2270 memcg = mem_cgroup_iter(NULL, memcg, NULL);