aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMel Gorman <mel@csn.ul.ie>2007-07-31 03:37:30 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-31 18:39:36 -0400
commita8bbf72ab9b3072ece630d97689145b1a2f01221 (patch)
tree4d55318fff1aecd3c5d2c1e877847bcb2347dd2e
parent252e48389ed30d7c77385fb92fca765a680de408 (diff)
Do not trigger OOM-killer for high-order allocation failures
out_of_memory() may be called when an allocation is failing and the direct reclaim is not making any progress. This does not take into account the requested order of the allocation. If the request if for an order larger than PAGE_ALLOC_COSTLY_ORDER, it is reasonable to fail the allocation because the kernel makes no guarantees about those allocations succeeding. This false OOM situation can occur if a user is trying to grow the hugepage pool in a script like; #!/bin/bash REQUIRED=$1 echo 1 > /proc/sys/vm/hugepages_treat_as_movable echo $REQUIRED > /proc/sys/vm/nr_hugepages ACTUAL=`cat /proc/sys/vm/nr_hugepages` while [ $REQUIRED -ne $ACTUAL ]; do echo Huge page pool at $ACTUAL growing to $REQUIRED echo $REQUIRED > /proc/sys/vm/nr_hugepages ACTUAL=`cat /proc/sys/vm/nr_hugepages` sleep 1 done This is a reasonable scenario when ZONE_MOVABLE is in use but triggers OOM easily on 2.6.23-rc1. This patch will fail an allocation for an order above PAGE_ALLOC_COSTLY_ORDER instead of killing processes and retrying. Signed-off-by: Mel Gorman <mel@csn.ul.ie> Acked-by: Andy Whitcroft <apw@shadowen.org> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/page_alloc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0bd4d82ddfff..3da85b81dabb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1350,6 +1350,10 @@ nofail_alloc:
1350 if (page) 1350 if (page)
1351 goto got_pg; 1351 goto got_pg;
1352 1352
1353 /* The OOM killer will not help higher order allocs so fail */
1354 if (order > PAGE_ALLOC_COSTLY_ORDER)
1355 goto nopage;
1356
1353 out_of_memory(zonelist, gfp_mask, order); 1357 out_of_memory(zonelist, gfp_mask, order);
1354 goto restart; 1358 goto restart;
1355 } 1359 }