mm: fix handling of panic_on_oom when cpusets are in use

The current panic_on_oom may not work if there is a process using
cpusets/mempolicy, because other nodes' memory may remain.  But some people
want failover by panic ASAP even if they are used.  This patch makes new
setting for its request.

This is tested on my ia64 box which has 3 nodes.

Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Paul Jackson <pj@sgi.com>
Cc: Ethan Solomita <solo@google.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Yasunori Goto 2007-05-06 14:49:59 -07:00 committed by Linus Torvalds
parent 824ebef122
commit 2b744c01a5
2 changed files with 20 additions and 6 deletions

View file

@ -197,11 +197,22 @@ and may not be fast.
panic_on_oom
This enables or disables panic on out-of-memory feature. If this is set to 1,
the kernel panics when out-of-memory happens. If this is set to 0, the kernel
will kill some rogue process, called oom_killer. Usually, oom_killer can kill
rogue processes and system will survive. If you want to panic the system
rather than killing rogue processes, set this to 1.
This enables or disables panic on out-of-memory feature.
If this is set to 0, the kernel will kill some rogue process,
called oom_killer. Usually, oom_killer can kill rogue processes and
system will survive.
If this is set to 1, the kernel panics when out-of-memory happens.
However, if a process limits using nodes by mempolicy/cpusets,
and those nodes become memory exhaustion status, one process
may be killed by oom-killer. No panic occurs in this case.
Because other nodes' memory may be free. This means system total status
may be not fatal yet.
If this is set to 2, the kernel panics compulsorily even on the
above-mentioned.
The default value is 0.
1 and 2 are for failover of clustering. Please select either
according to your policy of failover.

View file

@ -413,6 +413,9 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
show_mem();
}
if (sysctl_panic_on_oom == 2)
panic("out of memory. Compulsory panic_on_oom is selected.\n");
cpuset_lock();
read_lock(&tasklist_lock);