From 32478136cbe425a4ab392d99dad703d4f4f5cb08 Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Fri, 25 Feb 2011 14:44:20 -0800 Subject: [PATCH] --- yaml --- r: 233695 b: refs/heads/master c: 2876592f231d436c295b67726313f6f3cfb6e243 h: refs/heads/master i: 233693: d5fce455b81fe40a030d68d88df8e0bf4f6979fb 233691: 65cff7abb0221bee79c512feed7a5671ef9a16c1 233687: fb351ac3d88df2e538f988d3e8215d25e0251f4c 233679: 556773616347c9e1b8885db4955e85051c097ec2 233663: 36a6cc87cf0d0556707d8dc97b3f454889887eb2 v: v3 --- [refs] | 2 +- trunk/mm/vmscan.c | 32 ++++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index 2b31bcad66b9..fcdefe016601 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ac3c8304190ed0daaa2fb01ce2a069be5e2a52a7 +refs/heads/master: 2876592f231d436c295b67726313f6f3cfb6e243 diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index 17497d0cd8b9..6771ea70bfe7 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -1841,16 +1841,28 @@ static inline bool should_continue_reclaim(struct zone *zone, if (!(sc->reclaim_mode & RECLAIM_MODE_COMPACTION)) return false; - /* - * If we failed to reclaim and have scanned the full list, stop. - * NOTE: Checking just nr_reclaimed would exit reclaim/compaction far - * faster but obviously would be less likely to succeed - * allocation. If this is desirable, use GFP_REPEAT to decide - * if both reclaimed and scanned should be checked or just - * reclaimed - */ - if (!nr_reclaimed && !nr_scanned) - return false; + /* Consider stopping depending on scan and reclaim activity */ + if (sc->gfp_mask & __GFP_REPEAT) { + /* + * For __GFP_REPEAT allocations, stop reclaiming if the + * full LRU list has been scanned and we are still failing + * to reclaim pages. This full LRU scan is potentially + * expensive but a __GFP_REPEAT caller really wants to succeed + */ + if (!nr_reclaimed && !nr_scanned) + return false; + } else { + /* + * For non-__GFP_REPEAT allocations which can presumably + * fail without consequence, stop if we failed to reclaim + * any pages from the last SWAP_CLUSTER_MAX number of + * pages that were scanned. This will return to the + * caller faster at the risk reclaim/compaction and + * the resulting allocation attempt fails + */ + if (!nr_reclaimed) + return false; + } /* * If we have not reclaimed enough pages for compaction and the