aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2009-01-06 17:40:33 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:59:10 -0500
commit73ce02e96fe34a983199a9855b2ae738f960a6ee (patch)
tree06dbbc2c38d55f8eacab09c55a68c736156b9540 /mm
parent594fe1a044325bb0a1a49ca7d086e3df4f1df59a (diff)
mm: stop kswapd's infinite loop at high order allocation
Wassim Dagash reported following kswapd infinite loop problem. kswapd runs in some infinite loop trying to swap until order 10 of zone highmem is OK.... kswapd will continue to try to balance order 10 of zone highmem forever (or until someone release a very large chunk of highmem). For non order-0 allocations, the system may never be balanced due to fragmentation but kswapd should not infinitely loop as a result. Instead, recheck all watermarks at order-0 as they are the most important. If watermarks are ok, kswapd will go back to sleep. [akpm@linux-foundation.org: fix comment] Reported-by: wassim dagash <wassim.dagash@gmail.com> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Reviewed-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmscan.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5daf606e0a35..b07c48b09a93 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1867,6 +1867,23 @@ out:
1867 1867
1868 try_to_freeze(); 1868 try_to_freeze();
1869 1869
1870 /*
1871 * Fragmentation may mean that the system cannot be
1872 * rebalanced for high-order allocations in all zones.
1873 * At this point, if nr_reclaimed < SWAP_CLUSTER_MAX,
1874 * it means the zones have been fully scanned and are still
1875 * not balanced. For high-order allocations, there is
1876 * little point trying all over again as kswapd may
1877 * infinite loop.
1878 *
1879 * Instead, recheck all watermarks at order-0 as they
1880 * are the most important. If watermarks are ok, kswapd will go
1881 * back to sleep. High-order users can still perform direct
1882 * reclaim if they wish.
1883 */
1884 if (sc.nr_reclaimed < SWAP_CLUSTER_MAX)
1885 order = sc.order = 0;
1886
1870 goto loop_again; 1887 goto loop_again;
1871 } 1888 }
1872 1889