mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: Dmitry Yusupov <dima@neterion.com>,
	Alasdair G Kergon <agk@redhat.com>,
	Mike Christie <michaelc@cs.wisc.edu>,
	Alex Aizman <alex@neterion.com>
Subject: oom-killer disable for iscsi/lvm2/multipath userland critical sections
Date: Sat, 2 Apr 2005 00:14:00 +0200	[thread overview]
Message-ID: <20050401221400.GQ29492@g5.random> (raw)

Hello,

some private discussion (that was continuing some kernel-summit-discuss
thread) ended in the below patch. I also liked a textual "disable"
instead of value "-17" (internally to the kernel it could be represented
the same way, but the /proc parsing would be more complicated). If you
prefer textual "disable" we can change this of course.

Comments welcome.

From: Andrea Arcangeli <andrea@suse.de>
Subject: oom killer protection

iscsi/lvm2/multipath needs guaranteed protection from the oom-killer.

Signed-off-by: Andrea Arcangeli <andrea@suse.de>

--- 2.6.12-seccomp/fs/proc/base.c.~1~	2005-03-25 05:13:28.000000000 +0100
+++ 2.6.12-seccomp/fs/proc/base.c	2005-04-01 23:47:22.000000000 +0200
@@ -751,7 +751,7 @@ static ssize_t oom_adjust_write(struct f
 	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++;
--- 2.6.12-seccomp/include/linux/mm.h.~1~	2005-03-25 05:13:28.000000000 +0100
+++ 2.6.12-seccomp/include/linux/mm.h	2005-04-01 23:53:11.000000000 +0200
@@ -856,5 +856,8 @@ int in_gate_area_no_task(unsigned long a
 #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 */
--- 2.6.12-seccomp/mm/oom_kill.c.~1~	2005-03-08 01:02:30.000000000 +0100
+++ 2.6.12-seccomp/mm/oom_kill.c	2005-04-01 23:46:18.000000000 +0200
@@ -145,7 +145,7 @@ static struct task_struct * select_bad_p
 	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;
 
 			/*

             reply	other threads:[~2005-04-01 22:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-01 22:14 Andrea Arcangeli [this message]
2005-04-02  0:06 ` Dmitry Yusupov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050401221400.GQ29492@g5.random \
    --to=andrea@suse.de \
    --cc=agk@redhat.com \
    --cc=akpm@osdl.org \
    --cc=alex@neterion.com \
    --cc=dima@neterion.com \
    --cc=michaelc@cs.wisc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®