diff --git a/mm/vmscan.c b/mm/vmscan.c index 396ecee281d08ff0fb4135fb420c88e4dd6f8dc1..606d0bb46091bdc49e634f0f3d2b4d434e37900e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2194,6 +2194,13 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, if (sc->nr_reclaimed >= sc->nr_to_reclaim) goto out; + /* + * If we're getting trouble reclaiming, start doing + * writepage even in laptop mode. + */ + if (sc->priority < DEF_PRIORITY - 2) + sc->may_writepage = 1; + /* * Try to write back as many pages as we just scanned. This * tends to cause slow streaming writers to write data to the @@ -2765,12 +2772,10 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order, } /* - * If we've done a decent amount of scanning and - * the reclaim ratio is low, start doing writepage - * even in laptop mode + * If we're getting trouble reclaiming, start doing + * writepage even in laptop mode. */ - if (total_scanned > SWAP_CLUSTER_MAX * 2 && - total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2) + if (sc.priority < DEF_PRIORITY - 2) sc.may_writepage = 1; if (zone->all_unreclaimable) {