Commit bcf2fb27 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] vmscan: avoid bogus throttling

- If max_scan evaluates to zero due to a very small inactive list and high
  `priority' numbers, we don't want to thrlttle yet.

- In balance_pgdat(), we may end up not scanning any pages because all
  zones happened to be above pages_high.  Avoid throttling in this case too.
parent e5f02647
......@@ -870,6 +870,7 @@ int try_to_free_pages(struct zone **zones,
wakeup_bdflush(total_scanned);
/* Take a nap, wait for some writeback to complete */
if (total_scanned)
blk_congestion_wait(WRITE, HZ/10);
}
if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY))
......@@ -915,6 +916,7 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps)
for (priority = DEF_PRIORITY; priority; priority--) {
int all_zones_ok = 1;
int pages_scanned = 0;
for (i = 0; i < pgdat->nr_zones; i++) {
struct zone *zone = pgdat->node_zones + i;
......@@ -933,6 +935,7 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps)
max_scan = zone->nr_inactive >> priority;
reclaimed = shrink_zone(zone, max_scan, GFP_KERNEL,
&total_scanned, ps);
total_scanned += pages_scanned;
reclaim_state->reclaimed_slab = 0;
shrink_slab(total_scanned, GFP_KERNEL);
reclaimed += reclaim_state->reclaimed_slab;
......@@ -950,6 +953,7 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages, struct page_state *ps)
* OK, kswapd is getting into trouble. Take a nap, then take
* another pass across the zones.
*/
if (pages_scanned)
blk_congestion_wait(WRITE, HZ/10);
}
......
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