tree d0600c289b1a54902e3b78eec0729dc7011569a3
parent d345734267dbec642f4e34a9d392d2fd85b5fa9b
author Andrea Arcangeli <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:24:05 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sun, 17 Apr 2005 05:24:05 -0700

[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: Andrea Arcangeli <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 proc/base.c |    2 +-
 linux/mm.h  |    3 +++
 oom_kill.c  |    2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

Index: fs/proc/base.c
===================================================================
--- 9a74f4b8292a696620f95933171ac5ddff970ef9/fs/proc/base.c  (mode:100644 
sha1:dad8ea4e00a03efae08302c41e8951eb84eb811e)
+++ d0600c289b1a54902e3b78eec0729dc7011569a3/fs/proc/base.c  (mode:100644 
sha1:39fd336cfdb9ca68c354a22f432e74c63a9bf732)
@@ -751,7 +751,7 @@
        if (copy_from_user(buffer, buf, count))
                return -EFAULT;
        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;
        if (*end == '\n')
                end++;
Index: include/linux/mm.h
===================================================================
--- 9a74f4b8292a696620f95933171ac5ddff970ef9/include/linux/mm.h  (mode:100644 
sha1:6a931374d6c4975b89cecf5ffa6d6321b9f4eb8a)
+++ d0600c289b1a54902e3b78eec0729dc7011569a3/include/linux/mm.h  (mode:100644 
sha1:85f7d1bea937543327890cdd21be0ed967db416c)
@@ -857,5 +857,8 @@
 #define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
 #endif /* __HAVE_ARCH_GATE_AREA */
 
+/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
+#define OOM_DISABLE -17
+
 #endif /* __KERNEL__ */
 #endif /* _LINUX_MM_H */
Index: mm/oom_kill.c
===================================================================
--- 9a74f4b8292a696620f95933171ac5ddff970ef9/mm/oom_kill.c  (mode:100644 
sha1:9595a0f6c4b8891d832f109781d460060fada872)
+++ d0600c289b1a54902e3b78eec0729dc7011569a3/mm/oom_kill.c  (mode:100644 
sha1:4bbb1cb10495ea486db83868055762888835c8b3)
@@ -145,7 +145,7 @@
        do_posix_clock_monotonic_gettime(&uptime);
        do_each_thread(g, p)
                /* skip the init task with pid == 1 */
-               if (p->pid > 1) {
+               if (p->pid > 1 && p->oomkilladj != OOM_DISABLE) {
                        unsigned long points;
 
                        /*
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to