lkml.org 
[lkml]   [2006]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: OOM behavior in constrained memory situations
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-02-07 01:41    [W:0.063 / U:1.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site