diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2006-06-23 05:03:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:42:47 -0400 |
commit | fadd8fbd153c12963f8fe3c9ef7f8967f286f98b (patch) | |
tree | 547cdee6203b769773521118a4dd19e95a7ef3fd /mm | |
parent | 67de648211fa041fe08a0c25241a4980bbb90698 (diff) |
[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')
-rw-r--r-- | mm/oom_kill.c | 3 |
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 @@ | |||
22 | #include <linux/jiffies.h> | 22 | #include <linux/jiffies.h> |
23 | #include <linux/cpuset.h> | 23 | #include <linux/cpuset.h> |
24 | 24 | ||
25 | int sysctl_panic_on_oom; | ||
25 | /* #define DEBUG */ | 26 | /* #define DEBUG */ |
26 | 27 | ||
27 | /** | 28 | /** |
@@ -344,6 +345,8 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) | |||
344 | break; | 345 | break; |
345 | 346 | ||
346 | case CONSTRAINT_NONE: | 347 | case CONSTRAINT_NONE: |
348 | if (sysctl_panic_on_oom) | ||
349 | panic("out of memory. panic_on_oom is selected\n"); | ||
347 | retry: | 350 | retry: |
348 | /* | 351 | /* |
349 | * Rambo mode: Shoot down a process and hope it solves whatever | 352 | * Rambo mode: Shoot down a process and hope it solves whatever |