From df3da161b3129013e90fd95e744ed431ce307554 Mon Sep 17 00:00:00 2001 From: KOSAKI Motohiro Date: Tue, 6 Jan 2009 14:40:33 -0800 Subject: [PATCH] --- yaml --- r: 126261 b: refs/heads/master c: 73ce02e96fe34a983199a9855b2ae738f960a6ee h: refs/heads/master i: 126259: 9bf9ea0cdf2862c84477ece40b327a3c7e214fc6 v: v3 --- [refs] | 2 +- trunk/mm/vmscan.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 0d995613996c..a90543cdef42 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 594fe1a044325bb0a1a49ca7d086e3df4f1df59a +refs/heads/master: 73ce02e96fe34a983199a9855b2ae738f960a6ee diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index 5daf606e0a35..b07c48b09a93 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -1867,6 +1867,23 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order) try_to_freeze(); + /* + * Fragmentation may mean that the system cannot be + * rebalanced for high-order allocations in all zones. + * At this point, if nr_reclaimed < SWAP_CLUSTER_MAX, + * it means the zones have been fully scanned and are still + * not balanced. For high-order allocations, there is + * little point trying all over again as kswapd may + * infinite loop. + * + * Instead, recheck all watermarks at order-0 as they + * are the most important. If watermarks are ok, kswapd will go + * back to sleep. High-order users can still perform direct + * reclaim if they wish. + */ + if (sc.nr_reclaimed < SWAP_CLUSTER_MAX) + order = sc.order = 0; + goto loop_again; }