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();
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;
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;
* 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++) {