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; }