summary refs log tree commit diff
path: root/mm/oom_kill.c
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2006-06-23 02:03:13 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 07:42:47 -0700
commitfadd8fbd153c12963f8fe3c9ef7f8967f286f98b (patch)
tree547cdee6203b769773521118a4dd19e95a7ef3fd /mm/oom_kill.c
parent67de648211fa041fe08a0c25241a4980bbb90698 (diff)
downloadlinux-fadd8fbd153c12963f8fe3c9ef7f8967f286f98b.tar.gz
[PATCH] support for panic at OOM
This patch adds panic_on_oom sysctl under sys.vm.

When sysctl vm.panic_on_oom = 1, the kernel panics intead of killing rogue
processes.  And if vm.panic_on_oom is 0 the kernel will do oom_kill() in
the same way as it does today.  Of course, the default value is 0 and only
root can modifies it.

In general, oom_killer works well and kill rogue processes.  So the whole
system can survive.  But there are environments where panic is preferable
rather than kill some processes.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/oom_kill.c')
-rw-r--r--mm/oom_kill.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 042e6436c3ee..f9bb3cf32384 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -22,6 +22,7 @@
 #include <linux/jiffies.h>
 #include <linux/cpuset.h>
 
+int sysctl_panic_on_oom;
 /* #define DEBUG */
 
 /**
@@ -344,6 +345,8 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
 		break;
 
 	case CONSTRAINT_NONE:
+		if (sysctl_panic_on_oom)
+			panic("out of memory. panic_on_oom is selected\n");
 retry:
 		/*
 		 * Rambo mode: Shoot down a process and hope it solves whatever