Do not trigger OOM-killer for high-order allocation failures
Subsystems (2)
PATCH 1/1 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.
--- page_alloc.c | 4 ++++ 1 file changed, 4 insertions(+)
mm/page_alloc.c +4 -0
@@ -1350,6 +1350,10 @@ nofail_alloc:if (page) goto got_pg; +/* The OOM killer will not help higher order allocs so fail */ +if (order >PAGE_ALLOC_COSTLY_ORDER ) + goto nopage; +out_of_memory (zonelist, gfp_mask, order); goto restart; }
Signature · 9 lines
Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 21 lines · Mel Gorman
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 thanPAGE_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_movableecho $REQUIRED >/proc/sys/vm/nr_hugepagesACTUAL=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_hugepagesACTUAL=cat /proc/sys/vm/nr_hugepagessleep 1
done
Quoted 5 lines
This is a reasonable scenario when
ZONE_MOVABLEis in use but triggers OOM easily on 2.6.23-rc1. This patch will fail an allocation for an order abovePAGE_ALLOC_COSTLY_ORDERinstead of killing processes and retrying.Signed-off-by Mel Gorman <[email protected]>
We have had this problem for a long time. When allocating large pages we could find ourselves unable to allocate such a page nor reclaim one for ourselves. At this point we will OOM with little hope of that actually changing the situation for the better.
As you say PAGE_ALLOC_COSTLY_ORDER pretty much defines the orders at which any sort of guarantee of success is provided. It seems preferable to fail a allocations above this order/ than killing things to try and make it available. As higher order users already have to handle failure to allocate they should be best equipped to continue.
Quoted 9 lines
--- page_alloc.c | 4 ++++ 1 file changed, 4 insertions(+)mm/page_alloc.c +0
-0
mm/page_alloc.c nofail_alloc: · line 1359
Quoted 10 lines
mm/page_alloc.c +4
-0@@ -1350,6 +1350,10 @@ nofail_alloc:if (page) goto got_pg; +/* The OOM killer will not help higher order allocs so fail */ +if (order >PAGE_ALLOC_COSTLY_ORDER ) + goto nopage; +out_of_memory (zonelist, gfp_mask, order); goto restart; }
-apw
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>