diff options
-rw-r--r-- | fs/proc/base.c | 2 | ||||
-rw-r--r-- | include/linux/mm.h | 3 | ||||
-rw-r--r-- | mm/oom_kill.c | 2 |
3 files changed, 5 insertions, 2 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index dad8ea4e00a0..39fd336cfdb9 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -751,7 +751,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, | |||
751 | if (copy_from_user(buffer, buf, count)) | 751 | if (copy_from_user(buffer, buf, count)) |
752 | return -EFAULT; | 752 | return -EFAULT; |
753 | oom_adjust = simple_strtol(buffer, &end, 0); | 753 | oom_adjust = simple_strtol(buffer, &end, 0); |
754 | if (oom_adjust < -16 || oom_adjust > 15) | 754 | if ((oom_adjust < -16 || oom_adjust > 15) && oom_adjust != OOM_DISABLE) |
755 | return -EINVAL; | 755 | return -EINVAL; |
756 | if (*end == '\n') | 756 | if (*end == '\n') |
757 | end++; | 757 | end++; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 6a931374d6c4..85f7d1bea937 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -857,5 +857,8 @@ int in_gate_area_no_task(unsigned long addr); | |||
857 | #define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) | 857 | #define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) |
858 | #endif /* __HAVE_ARCH_GATE_AREA */ | 858 | #endif /* __HAVE_ARCH_GATE_AREA */ |
859 | 859 | ||
860 | /* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */ | ||
861 | #define OOM_DISABLE -17 | ||
862 | |||
860 | #endif /* __KERNEL__ */ | 863 | #endif /* __KERNEL__ */ |
861 | #endif /* _LINUX_MM_H */ | 864 | #endif /* _LINUX_MM_H */ |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 9595a0f6c4b8..4bbb1cb10495 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -145,7 +145,7 @@ static struct task_struct * select_bad_process(void) | |||
145 | do_posix_clock_monotonic_gettime(&uptime); | 145 | do_posix_clock_monotonic_gettime(&uptime); |
146 | do_each_thread(g, p) | 146 | do_each_thread(g, p) |
147 | /* skip the init task with pid == 1 */ | 147 | /* skip the init task with pid == 1 */ |
148 | if (p->pid > 1) { | 148 | if (p->pid > 1 && p->oomkilladj != OOM_DISABLE) { |
149 | unsigned long points; | 149 | unsigned long points; |
150 | 150 | ||
151 | /* | 151 | /* |