aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sysctl/vm.txt22
-rw-r--r--kernel/sysctl.c9
-rw-r--r--mm/oom_kill.c13
3 files changed, 39 insertions, 5 deletions
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index a0ccc5b60260..17346da636e7 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -31,6 +31,7 @@ Currently, these files are in /proc/sys/vm:
31- min_unmapped_ratio 31- min_unmapped_ratio
32- min_slab_ratio 32- min_slab_ratio
33- panic_on_oom 33- panic_on_oom
34- oom_kill_allocating_task
34- mmap_min_address 35- mmap_min_address
35- numa_zonelist_order 36- numa_zonelist_order
36 37
@@ -220,6 +221,27 @@ The default value is 0.
2201 and 2 are for failover of clustering. Please select either 2211 and 2 are for failover of clustering. Please select either
221according to your policy of failover. 222according to your policy of failover.
222 223
224=============================================================
225
226oom_kill_allocating_task
227
228This enables or disables killing the OOM-triggering task in
229out-of-memory situations.
230
231If this is set to zero, the OOM killer will scan through the entire
232tasklist and select a task based on heuristics to kill. This normally
233selects a rogue memory-hogging task that frees up a large amount of
234memory when killed.
235
236If this is set to non-zero, the OOM killer simply kills the task that
237triggered the out-of-memory condition. This avoids the expensive
238tasklist scan.
239
240If panic_on_oom is selected, it takes precedence over whatever value
241is used in oom_kill_allocating_task.
242
243The default value is 0.
244
223============================================================== 245==============================================================
224 246
225mmap_min_addr 247mmap_min_addr
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c676b5ec88f5..5e63de0f9ee2 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -63,6 +63,7 @@ extern int print_fatal_signals;
63extern int sysctl_overcommit_memory; 63extern int sysctl_overcommit_memory;
64extern int sysctl_overcommit_ratio; 64extern int sysctl_overcommit_ratio;
65extern int sysctl_panic_on_oom; 65extern int sysctl_panic_on_oom;
66extern int sysctl_oom_kill_allocating_task;
66extern int max_threads; 67extern int max_threads;
67extern int core_uses_pid; 68extern int core_uses_pid;
68extern int suid_dumpable; 69extern int suid_dumpable;
@@ -781,6 +782,14 @@ static ctl_table vm_table[] = {
781 .proc_handler = &proc_dointvec, 782 .proc_handler = &proc_dointvec,
782 }, 783 },
783 { 784 {
785 .ctl_name = CTL_UNNUMBERED,
786 .procname = "oom_kill_allocating_task",
787 .data = &sysctl_oom_kill_allocating_task,
788 .maxlen = sizeof(sysctl_oom_kill_allocating_task),
789 .mode = 0644,
790 .proc_handler = &proc_dointvec,
791 },
792 {
784 .ctl_name = VM_OVERCOMMIT_RATIO, 793 .ctl_name = VM_OVERCOMMIT_RATIO,
785 .procname = "overcommit_ratio", 794 .procname = "overcommit_ratio",
786 .data = &sysctl_overcommit_ratio, 795 .data = &sysctl_overcommit_ratio,
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 6e999c88c503..00d0bd7d6a2b 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -27,6 +27,7 @@
27#include <linux/notifier.h> 27#include <linux/notifier.h>
28 28
29int sysctl_panic_on_oom; 29int sysctl_panic_on_oom;
30int sysctl_oom_kill_allocating_task;
30static DEFINE_MUTEX(zone_scan_mutex); 31static DEFINE_MUTEX(zone_scan_mutex);
31/* #define DEBUG */ 32/* #define DEBUG */
32 33
@@ -471,14 +472,16 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
471 "No available memory (MPOL_BIND)"); 472 "No available memory (MPOL_BIND)");
472 break; 473 break;
473 474
474 case CONSTRAINT_CPUSET:
475 oom_kill_process(current, points,
476 "No available memory in cpuset");
477 break;
478
479 case CONSTRAINT_NONE: 475 case CONSTRAINT_NONE:
480 if (sysctl_panic_on_oom) 476 if (sysctl_panic_on_oom)
481 panic("out of memory. panic_on_oom is selected\n"); 477 panic("out of memory. panic_on_oom is selected\n");
478 /* Fall-through */
479 case CONSTRAINT_CPUSET:
480 if (sysctl_oom_kill_allocating_task) {
481 oom_kill_process(current, points,
482 "Out of memory (oom_kill_allocating_task)");
483 break;
484 }
482retry: 485retry:
483 /* 486 /*
484 * Rambo mode: Shoot down a process and hope it solves whatever 487 * Rambo mode: Shoot down a process and hope it solves whatever