Commit 114b0865 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] shrink_all_memory() fixes

- Off-by-one in balance_pgdat means that we're not scanning the zones all
  the way down to priority=0.

- Always set zone->temp_priority in shrink_caches().  I'm not sure why I had
  the `if (zone->free_pages < zone->pages_high)' test in there, but it's
  preventing us from setting ->prev_priority correctly on the
  try_to_free_pages() path.

- Set zone->prev_priority to the current priority if it's currently a
  "lower" priority.  This allows us to build up the pressure on mapped pages
  on the first scanning pass rather than only on successive passes.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 97e012bb
...@@ -813,8 +813,9 @@ shrink_caches(struct zone **zones, int priority, int *total_scanned, ...@@ -813,8 +813,9 @@ shrink_caches(struct zone **zones, int priority, int *total_scanned,
struct zone *zone = zones[i]; struct zone *zone = zones[i];
int max_scan; int max_scan;
if (zone->free_pages < zone->pages_high)
zone->temp_priority = priority; zone->temp_priority = priority;
if (zone->prev_priority > priority)
zone->prev_priority = priority;
if (zone->all_unreclaimable && priority != DEF_PRIORITY) if (zone->all_unreclaimable && priority != DEF_PRIORITY)
continue; /* Let kswapd poll it */ continue; /* Let kswapd poll it */
...@@ -945,7 +946,7 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps) ...@@ -945,7 +946,7 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps)
zone->temp_priority = DEF_PRIORITY; zone->temp_priority = DEF_PRIORITY;
} }
for (priority = DEF_PRIORITY; priority; priority--) { for (priority = DEF_PRIORITY; priority >= 0; priority--) {
int all_zones_ok = 1; int all_zones_ok = 1;
int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */
...@@ -995,6 +996,8 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps) ...@@ -995,6 +996,8 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps)
all_zones_ok = 0; all_zones_ok = 0;
} }
zone->temp_priority = priority; zone->temp_priority = priority;
if (zone->prev_priority > priority)
zone->prev_priority = priority;
max_scan = (zone->nr_active + zone->nr_inactive) max_scan = (zone->nr_active + zone->nr_inactive)
>> priority; >> priority;
reclaimed = shrink_zone(zone, max_scan, GFP_KERNEL, reclaimed = shrink_zone(zone, max_scan, GFP_KERNEL,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment