From: Dan Kegel <dank@kegel.com>
To: Rob Landley <landley@trommello.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: OOM killer hints (was: Re: Kernel call chain search tool?)
Date: Thu, 26 Sep 2002 17:39:36 -0700 [thread overview]
Message-ID: <3D93A8C8.EB1BB878@kegel.com> (raw)
In-Reply-To: 20020927000451.98A9E398@merlin.webofficenow.com
Rob Landley wrote:
>
> On Thursday 26 September 2002 12:17 pm, Dan Kegel wrote:
>
> > If only the darn program didn't have so many threads, RLIMIT_AS
> > or the no-overcommit patch would be perfect. I unfortunately can't
> > get rid of the threads, so I'm stuck trying to figure out some way
> > to kill the right program when the system gets low on memory.
> >
> > Maybe I should look at giving the OOM killer hints?
>
> The OOM killer should certainly know about threads and thread groups. If you
> kill one thread, you generally have to kill the whole group because there's
> no way of knowing if that thread was holding a futex or otherwise custodian
> of critical data and thus you just threw the program into la-la land.
The OOM killer gets that part right; it kills all threads that share the
same mm. Where it screws up is in picking the process to kill.
This is understandable, since it's a tough problem.
Hey, how about this: I could teach the OOM killer to look at
RLIMIT_RSS. Processes which were at or nearly at their RLIMIT_RSS
would be killed first. That would be more generally useful than
my hacky little patch, and it would be even tinier. Like this, say:
--- oom_kill.c.orig Thu Sep 26 17:31:12 2002
+++ oom_kill.c Thu Sep 26 17:36:44 2002
@@ -86,6 +86,15 @@
points *= 2;
/*
+ * Processes at or near their RSS or AS limits are probably causing
+ * trouble, so double their badness points.
+ */
+ if (((3 * p->mm->rss) / 4) >= (p->rlim[RLIMIT_RSS].rlim_max >>
PAGE_SHIFT))
+ points *= 2;
+ if (((3 * p->mm->total_vm) / 4) >= (p->rlim[RLIMIT_AS].rlim_max >>
PAGE_SHIFT))
+ points *= 2;
+
+ /*
* Superuser processes are usually more important, so we make it
* less likely that we kill those.
*/
How's that look?
- Dan
prev parent reply other threads:[~2002-09-27 0:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-25 4:36 Kernel call chain search tool? Dan Kegel
2002-09-26 15:15 ` Alan Cox
2002-09-26 16:17 ` Dan Kegel
2002-09-26 19:07 ` Rob Landley
2002-09-27 0:39 ` Dan Kegel [this message]
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=3D93A8C8.EB1BB878@kegel.com \
--to=dank@kegel.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=landley@trommello.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.