Commit 79befd0c authored by Andrea Arcangeli's avatar Andrea Arcangeli Committed by Linus Torvalds

[PATCH] oom-killer disable for iscsi/lvm2/multipath userland critical sections

iscsi/lvm2/multipath needs guaranteed protection from the oom-killer, so
make the magical value of -17 in /proc/<pid>/oom_adj defeat the oom-killer
altogether.

(akpm: we still need to document oom_adj and friends in
Documentation/filesystems/proc.txt!)
Signed-off-by: default avatarAndrea Arcangeli <andrea@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d3457342
...@@ -751,7 +751,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, ...@@ -751,7 +751,7 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
if (copy_from_user(buffer, buf, count)) if (copy_from_user(buffer, buf, count))
return -EFAULT; return -EFAULT;
oom_adjust = simple_strtol(buffer, &end, 0); oom_adjust = simple_strtol(buffer, &end, 0);
if (oom_adjust < -16 || oom_adjust > 15) if ((oom_adjust < -16 || oom_adjust > 15) && oom_adjust != OOM_DISABLE)
return -EINVAL; return -EINVAL;
if (*end == '\n') if (*end == '\n')
end++; end++;
......
...@@ -857,5 +857,8 @@ int in_gate_area_no_task(unsigned long addr); ...@@ -857,5 +857,8 @@ int in_gate_area_no_task(unsigned long addr);
#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) #define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
#endif /* __HAVE_ARCH_GATE_AREA */ #endif /* __HAVE_ARCH_GATE_AREA */
/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
#define OOM_DISABLE -17
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _LINUX_MM_H */ #endif /* _LINUX_MM_H */
...@@ -145,7 +145,7 @@ static struct task_struct * select_bad_process(void) ...@@ -145,7 +145,7 @@ static struct task_struct * select_bad_process(void)
do_posix_clock_monotonic_gettime(&uptime); do_posix_clock_monotonic_gettime(&uptime);
do_each_thread(g, p) do_each_thread(g, p)
/* skip the init task with pid == 1 */ /* skip the init task with pid == 1 */
if (p->pid > 1) { if (p->pid > 1 && p->oomkilladj != OOM_DISABLE) {
unsigned long points; unsigned long points;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment