From: Dan Kegel <dank@kegel.com>
To: linux-kernel@vger.kernel.org
Subject: Protecting processes from the OOM killer
Date: Thu, 27 Feb 2003 17:21:44 -0800 [thread overview]
Message-ID: <3E5EB9A8.3010807@kegel.com> (raw)
For a while now, I've been trying to figure out how
to make the oom killer not kill important processes.
How about rewarding processes that have an
RSS limit if they stay well below it?
The operator can then mark processes that are important
by using 'ulimit -m'.
(This is orthogonal to Rik's recent patch.)
--- oom_kill.c.orig 2002-09-26 17:31:12.000000000 -0700
+++ oom_kill.c 2003-02-27 16:59:46.000000000 -0800
@@ -86,6 +90,18 @@
points *= 2;
/*
+ * Processes which *have* an RSS limit, but which are under half of it,
+ * are behaving well, so halve their badness points.
+ * Do it again if they're under a quarter of their RSS limit.
+ */
+ if (p->rlim[RLIMIT_RSS].rlim_max != ULONG_MAX) {
+ if (p->mm->rss < (p->rlim[RLIMIT_RSS].rlim_max >> (PAGE_SHIFT+1)))
+ points /= 2;
+ if (p->mm->rss < (p->rlim[RLIMIT_RSS].rlim_max >> (PAGE_SHIFT+2)))
+ points /= 2;
+ }
+
+ /*
* Superuser processes are usually more important, so we make it
* less likely that we kill those.
*/
--
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045
next reply other threads:[~2003-02-28 1:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-28 1:21 Dan Kegel [this message]
2003-02-28 13:40 ` Protecting processes from the OOM killer Alan Cox
2003-02-28 14:19 ` Ville Herva
2003-02-28 15:37 ` Alan Cox
2003-02-28 16:08 ` Dan Kegel
2003-02-28 22:13 ` James Antill
2003-03-03 14:45 ` Jesse Pollard
2003-03-03 16:23 ` Alan Cox
2003-03-03 16:41 ` Dan Kegel
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=3E5EB9A8.3010807@kegel.com \
--to=dank@kegel.com \
--cc=linux-kernel@vger.kernel.org \
/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