aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sysctl/vm.txt13
-rw-r--r--include/linux/sysctl.h1
-rw-r--r--kernel/sysctl.c9
-rw-r--r--mm/oom_kill.c3
4 files changed, 26 insertions, 0 deletions
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index a46c10fcddfc..2dc246af4885 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -29,6 +29,7 @@ Currently, these files are in /proc/sys/vm:
29- drop-caches 29- drop-caches
30- zone_reclaim_mode 30- zone_reclaim_mode
31- zone_reclaim_interval 31- zone_reclaim_interval
32- panic_on_oom
32 33
33============================================================== 34==============================================================
34 35
@@ -178,3 +179,15 @@ Time is set in seconds and set by default to 30 seconds.
178Reduce the interval if undesired off node allocations occur. However, too 179Reduce the interval if undesired off node allocations occur. However, too
179frequent scans will have a negative impact onoff node allocation performance. 180frequent scans will have a negative impact onoff node allocation performance.
180 181
182=============================================================
183
184panic_on_oom
185
186This enables or disables panic on out-of-memory feature. If this is set to 1,
187the kernel panics when out-of-memory happens. If this is set to 0, the kernel
188will kill some rogue process, called oom_killer. Usually, oom_killer can kill
189rogue processes and system will survive. If you want to panic the system
190rather than killing rogue processes, set this to 1.
191
192The default value is 0.
193
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index cee944dbdcd4..c7132029af0f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -186,6 +186,7 @@ enum
186 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */ 186 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
187 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */ 187 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */
188 VM_ZONE_RECLAIM_INTERVAL=32, /* time period to wait after reclaim failure */ 188 VM_ZONE_RECLAIM_INTERVAL=32, /* time period to wait after reclaim failure */
189 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
189}; 190};
190 191
191 192
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 0d656e61621d..072ac446810a 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -59,6 +59,7 @@ extern int proc_nr_files(ctl_table *table, int write, struct file *filp,
59extern int C_A_D; 59extern int C_A_D;
60extern int sysctl_overcommit_memory; 60extern int sysctl_overcommit_memory;
61extern int sysctl_overcommit_ratio; 61extern int sysctl_overcommit_ratio;
62extern int sysctl_panic_on_oom;
62extern int max_threads; 63extern int max_threads;
63extern int sysrq_enabled; 64extern int sysrq_enabled;
64extern int core_uses_pid; 65extern int core_uses_pid;
@@ -702,6 +703,14 @@ static ctl_table vm_table[] = {
702 .proc_handler = &proc_dointvec, 703 .proc_handler = &proc_dointvec,
703 }, 704 },
704 { 705 {
706 .ctl_name = VM_PANIC_ON_OOM,
707 .procname = "panic_on_oom",
708 .data = &sysctl_panic_on_oom,
709 .maxlen = sizeof(sysctl_panic_on_oom),
710 .mode = 0644,
711 .proc_handler = &proc_dointvec,
712 },
713 {
705 .ctl_name = VM_OVERCOMMIT_RATIO, 714 .ctl_name = VM_OVERCOMMIT_RATIO,
706 .procname = "overcommit_ratio", 715 .procname = "overcommit_ratio",
707 .data = &sysctl_overcommit_ratio, 716 .data = &sysctl_overcommit_ratio,
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
25int 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");
347retry: 350retry:
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