diff options
-rw-r--r-- | mm/vmscan.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 5faa7739487f..13f050d667e9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1410,6 +1410,8 @@ static void shrink_zone(int priority, struct zone *zone, | |||
1410 | unsigned long nr_to_scan; | 1410 | unsigned long nr_to_scan; |
1411 | unsigned long percent[2]; /* anon @ 0; file @ 1 */ | 1411 | unsigned long percent[2]; /* anon @ 0; file @ 1 */ |
1412 | enum lru_list l; | 1412 | enum lru_list l; |
1413 | unsigned long nr_reclaimed = sc->nr_reclaimed; | ||
1414 | unsigned long swap_cluster_max = sc->swap_cluster_max; | ||
1413 | 1415 | ||
1414 | get_scan_ratio(zone, sc, percent); | 1416 | get_scan_ratio(zone, sc, percent); |
1415 | 1417 | ||
@@ -1425,7 +1427,7 @@ static void shrink_zone(int priority, struct zone *zone, | |||
1425 | } | 1427 | } |
1426 | zone->lru[l].nr_scan += scan; | 1428 | zone->lru[l].nr_scan += scan; |
1427 | nr[l] = zone->lru[l].nr_scan; | 1429 | nr[l] = zone->lru[l].nr_scan; |
1428 | if (nr[l] >= sc->swap_cluster_max) | 1430 | if (nr[l] >= swap_cluster_max) |
1429 | zone->lru[l].nr_scan = 0; | 1431 | zone->lru[l].nr_scan = 0; |
1430 | else | 1432 | else |
1431 | nr[l] = 0; | 1433 | nr[l] = 0; |
@@ -1444,12 +1446,11 @@ static void shrink_zone(int priority, struct zone *zone, | |||
1444 | nr[LRU_INACTIVE_FILE]) { | 1446 | nr[LRU_INACTIVE_FILE]) { |
1445 | for_each_evictable_lru(l) { | 1447 | for_each_evictable_lru(l) { |
1446 | if (nr[l]) { | 1448 | if (nr[l]) { |
1447 | nr_to_scan = min(nr[l], | 1449 | nr_to_scan = min(nr[l], swap_cluster_max); |
1448 | (unsigned long)sc->swap_cluster_max); | ||
1449 | nr[l] -= nr_to_scan; | 1450 | nr[l] -= nr_to_scan; |
1450 | 1451 | ||
1451 | sc->nr_reclaimed += shrink_list(l, nr_to_scan, | 1452 | nr_reclaimed += shrink_list(l, nr_to_scan, |
1452 | zone, sc, priority); | 1453 | zone, sc, priority); |
1453 | } | 1454 | } |
1454 | } | 1455 | } |
1455 | /* | 1456 | /* |
@@ -1460,11 +1461,13 @@ static void shrink_zone(int priority, struct zone *zone, | |||
1460 | * with multiple processes reclaiming pages, the total | 1461 | * with multiple processes reclaiming pages, the total |
1461 | * freeing target can get unreasonably large. | 1462 | * freeing target can get unreasonably large. |
1462 | */ | 1463 | */ |
1463 | if (sc->nr_reclaimed > sc->swap_cluster_max && | 1464 | if (nr_reclaimed > swap_cluster_max && |
1464 | priority < DEF_PRIORITY && !current_is_kswapd()) | 1465 | priority < DEF_PRIORITY && !current_is_kswapd()) |
1465 | break; | 1466 | break; |
1466 | } | 1467 | } |
1467 | 1468 | ||
1469 | sc->nr_reclaimed = nr_reclaimed; | ||
1470 | |||
1468 | /* | 1471 | /* |
1469 | * Even if we did not try to evict anon pages at all, we want to | 1472 | * Even if we did not try to evict anon pages at all, we want to |
1470 | * rebalance the anon lru active/inactive ratio. | 1473 | * rebalance the anon lru active/inactive ratio. |