diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/vmscan.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 8277f93148b5..f8b94ea6f722 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1596,6 +1596,14 @@ int zone_reclaim_mode __read_mostly; | |||
1596 | * Mininum time between zone reclaim scans | 1596 | * Mininum time between zone reclaim scans |
1597 | */ | 1597 | */ |
1598 | #define ZONE_RECLAIM_INTERVAL 30*HZ | 1598 | #define ZONE_RECLAIM_INTERVAL 30*HZ |
1599 | |||
1600 | /* | ||
1601 | * Priority for ZONE_RECLAIM. This determines the fraction of pages | ||
1602 | * of a node considered for each zone_reclaim. 4 scans 1/16th of | ||
1603 | * a zone. | ||
1604 | */ | ||
1605 | #define ZONE_RECLAIM_PRIORITY 4 | ||
1606 | |||
1599 | /* | 1607 | /* |
1600 | * Try to free up some pages from this zone through reclaim. | 1608 | * Try to free up some pages from this zone through reclaim. |
1601 | */ | 1609 | */ |
@@ -1626,7 +1634,7 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) | |||
1626 | sc.may_swap = 0; | 1634 | sc.may_swap = 0; |
1627 | sc.nr_scanned = 0; | 1635 | sc.nr_scanned = 0; |
1628 | sc.nr_reclaimed = 0; | 1636 | sc.nr_reclaimed = 0; |
1629 | sc.priority = 0; | 1637 | sc.priority = ZONE_RECLAIM_PRIORITY + 1; |
1630 | sc.nr_mapped = read_page_state(nr_mapped); | 1638 | sc.nr_mapped = read_page_state(nr_mapped); |
1631 | sc.gfp_mask = gfp_mask; | 1639 | sc.gfp_mask = gfp_mask; |
1632 | 1640 | ||
@@ -1643,7 +1651,15 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order) | |||
1643 | reclaim_state.reclaimed_slab = 0; | 1651 | reclaim_state.reclaimed_slab = 0; |
1644 | p->reclaim_state = &reclaim_state; | 1652 | p->reclaim_state = &reclaim_state; |
1645 | 1653 | ||
1646 | shrink_zone(zone, &sc); | 1654 | /* |
1655 | * Free memory by calling shrink zone with increasing priorities | ||
1656 | * until we have enough memory freed. | ||
1657 | */ | ||
1658 | do { | ||
1659 | sc.priority--; | ||
1660 | shrink_zone(zone, &sc); | ||
1661 | |||
1662 | } while (sc.nr_reclaimed < nr_pages && sc.priority > 0); | ||
1647 | 1663 | ||
1648 | p->reclaim_state = NULL; | 1664 | p->reclaim_state = NULL; |
1649 | current->flags &= ~PF_MEMALLOC; | 1665 | current->flags &= ~PF_MEMALLOC; |