diff options
Diffstat (limited to 'mm/vmscan.c')
| -rw-r--r-- | mm/vmscan.c | 28 | 
1 files changed, 12 insertions, 16 deletions
| diff --git a/mm/vmscan.c b/mm/vmscan.c index 9a27c44aa327..6177e3bcd66b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
| @@ -2057,31 +2057,31 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int prio, | |||
| 2057 | int pass, struct scan_control *sc) | 2057 | int pass, struct scan_control *sc) | 
| 2058 | { | 2058 | { | 
| 2059 | struct zone *zone; | 2059 | struct zone *zone; | 
| 2060 | unsigned long nr_to_scan, ret = 0; | 2060 | unsigned long ret = 0; | 
| 2061 | enum lru_list l; | ||
| 2062 | 2061 | ||
| 2063 | for_each_zone(zone) { | 2062 | for_each_zone(zone) { | 
| 2063 | enum lru_list l; | ||
| 2064 | 2064 | ||
| 2065 | if (!populated_zone(zone)) | 2065 | if (!populated_zone(zone)) | 
| 2066 | continue; | 2066 | continue; | 
| 2067 | |||
| 2068 | if (zone_is_all_unreclaimable(zone) && prio != DEF_PRIORITY) | 2067 | if (zone_is_all_unreclaimable(zone) && prio != DEF_PRIORITY) | 
| 2069 | continue; | 2068 | continue; | 
| 2070 | 2069 | ||
| 2071 | for_each_evictable_lru(l) { | 2070 | for_each_evictable_lru(l) { | 
| 2071 | enum zone_stat_item ls = NR_LRU_BASE + l; | ||
| 2072 | unsigned long lru_pages = zone_page_state(zone, ls); | ||
| 2073 | |||
| 2072 | /* For pass = 0, we don't shrink the active list */ | 2074 | /* For pass = 0, we don't shrink the active list */ | 
| 2073 | if (pass == 0 && | 2075 | if (pass == 0 && (l == LRU_ACTIVE_ANON || | 
| 2074 | (l == LRU_ACTIVE || l == LRU_ACTIVE_FILE)) | 2076 | l == LRU_ACTIVE_FILE)) | 
| 2075 | continue; | 2077 | continue; | 
| 2076 | 2078 | ||
| 2077 | zone->lru[l].nr_scan += | 2079 | zone->lru[l].nr_scan += (lru_pages >> prio) + 1; | 
| 2078 | (zone_page_state(zone, NR_LRU_BASE + l) | ||
| 2079 | >> prio) + 1; | ||
| 2080 | if (zone->lru[l].nr_scan >= nr_pages || pass > 3) { | 2080 | if (zone->lru[l].nr_scan >= nr_pages || pass > 3) { | 
| 2081 | unsigned long nr_to_scan; | ||
| 2082 | |||
| 2081 | zone->lru[l].nr_scan = 0; | 2083 | zone->lru[l].nr_scan = 0; | 
| 2082 | nr_to_scan = min(nr_pages, | 2084 | nr_to_scan = min(nr_pages, lru_pages); | 
| 2083 | zone_page_state(zone, | ||
| 2084 | NR_LRU_BASE + l)); | ||
| 2085 | ret += shrink_list(l, nr_to_scan, zone, | 2085 | ret += shrink_list(l, nr_to_scan, zone, | 
| 2086 | sc, prio); | 2086 | sc, prio); | 
| 2087 | if (ret >= nr_pages) | 2087 | if (ret >= nr_pages) | 
| @@ -2089,7 +2089,6 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int prio, | |||
| 2089 | } | 2089 | } | 
| 2090 | } | 2090 | } | 
| 2091 | } | 2091 | } | 
| 2092 | |||
| 2093 | return ret; | 2092 | return ret; | 
| 2094 | } | 2093 | } | 
| 2095 | 2094 | ||
| @@ -2112,7 +2111,6 @@ unsigned long shrink_all_memory(unsigned long nr_pages) | |||
| 2112 | .may_swap = 0, | 2111 | .may_swap = 0, | 
| 2113 | .swap_cluster_max = nr_pages, | 2112 | .swap_cluster_max = nr_pages, | 
| 2114 | .may_writepage = 1, | 2113 | .may_writepage = 1, | 
| 2115 | .swappiness = vm_swappiness, | ||
| 2116 | .isolate_pages = isolate_pages_global, | 2114 | .isolate_pages = isolate_pages_global, | 
| 2117 | }; | 2115 | }; | 
| 2118 | 2116 | ||
| @@ -2146,10 +2144,8 @@ unsigned long shrink_all_memory(unsigned long nr_pages) | |||
| 2146 | int prio; | 2144 | int prio; | 
| 2147 | 2145 | ||
| 2148 | /* Force reclaiming mapped pages in the passes #3 and #4 */ | 2146 | /* Force reclaiming mapped pages in the passes #3 and #4 */ | 
| 2149 | if (pass > 2) { | 2147 | if (pass > 2) | 
| 2150 | sc.may_swap = 1; | 2148 | sc.may_swap = 1; | 
| 2151 | sc.swappiness = 100; | ||
| 2152 | } | ||
| 2153 | 2149 | ||
| 2154 | for (prio = DEF_PRIORITY; prio >= 0; prio--) { | 2150 | for (prio = DEF_PRIORITY; prio >= 0; prio--) { | 
| 2155 | unsigned long nr_to_scan = nr_pages - ret; | 2151 | unsigned long nr_to_scan = nr_pages - ret; | 
