From bcf2fb27bb108e2a022d6ae02588a79985e33b3e Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 11 Mar 2004 16:24:20 -0800 Subject: [PATCH] [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. --- mm/vmscan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index ba9be09720888..33d83aa788e5b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -870,7 +870,8 @@ int try_to_free_pages(struct zone **zones, wakeup_bdflush(total_scanned); /* Take a nap, wait for some writeback to complete */ - blk_congestion_wait(WRITE, HZ/10); + if (total_scanned) + blk_congestion_wait(WRITE, HZ/10); } if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY)) out_of_memory(); @@ -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,7 +953,8 @@ 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. */ - blk_congestion_wait(WRITE, HZ/10); + if (pages_scanned) + blk_congestion_wait(WRITE, HZ/10); } for (i = 0; i < pgdat->nr_zones; i++) { -- 2.53.0