Re: OOM behavior in constrained memory situations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 6 Feb 2006, Paul Jackson wrote:

> If it is the case that some code path leads to the OOM killer, then
> I don't agree that memory restrictions such as cpuset constraints
> should mean we avoid the OOM killer.
> 
> I've already changed the OOM killer to only go after tasks in or
> overlapping with the same cpuset.

That is not enough. Memory access may also be restricted by policies
and then the OOM killer will still go postal. If a process has restricted
its memory allocation by either setting up a policy or a cpuset constrain
then the OOM killer should not be called. Instead either the application 
needs to be terminated (if it set the stupid policy) or the cpuset can 
perform something OOM-killer-like on the processes it controls.

In its simplest form this could look like the following patch (missing 
support for vma policies, and its not certain that a process has just 
attempted an allocation constrained by policy if mempolicy is set).

Maybe we need to set a gfp flag for constrained allocations that will
terminate the app?

Index: linux-2.6.16-rc2/mm/page_alloc.c
===================================================================
--- linux-2.6.16-rc2.orig/mm/page_alloc.c	2006-02-02 22:03:08.000000000 -0800
+++ linux-2.6.16-rc2/mm/page_alloc.c	2006-02-06 16:36:20.000000000 -0800
@@ -1011,6 +1011,15 @@ rebalance:
 		if (page)
 			goto got_pg;
 
+		if (current->mempolicy && current->mempolicy->policy == MPOL_BIND)
+			/*
+			 * Process has set up a memory policy which may
+			 * constrain allocations. This is not a case
+			 * for the OOM killer. Terminate the application
+			 * instead.
+			 */
+			return NULL;
+
 		out_of_memory(gfp_mask, order);
 		goto restart;
 	}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux