From: Evgeniy Polyakov <zbr@ioremap.net>
To: David Rientjes <rientjes@google.com>
Cc: Bill Davidsen <davidsen@tmr.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: Linux killed Kenny, bastard!
Date: Tue, 13 Jan 2009 14:54:08 +0300 [thread overview]
Message-ID: <20090113115408.GA22289@ioremap.net> (raw)
In-Reply-To: <alpine.DEB.2.00.0901130134090.25386@chino.kir.corp.google.com>
On Tue, Jan 13, 2009 at 01:54:02AM -0800, David Rientjes (rientjes@google.com) wrote:
> > It is a theory, not a practice. OOM-killer most of time starts from ssh,
> > database and lighttpd on the tested machines, when it could start in
> > the reverse order and do not touch ssh at all. Better not from daemon
> > itself, but its fastcgi spawned processes.
>
> In the unconstrained system-wide oom case, it scans each task on the
> system (which can take very long, ask SGI) and rates its badness scoring.
> When a memory-hogging task is identified, which you have complete control
> over in userspace by tuning /proc/pid/oom_adj, it attempts to kill a child
> first if it will allow for memory freeing without killing the parent.
Should this explain why ssh is killed?
> > I agree, that there are ways to tune the way oom-killer selects the
> > victim, and likely after hours of games this subtly will work for the
> > specified workload.
>
> It doesn't involve "hours of games," it is a very simple heuristic that
> you can easily tune to specify your preferences.
>
> What you're looking for with your patch is simply a way to specify an oom
> preference before the task has been forked, but that's simple to do with
> the current logic since oom_adj scores are inherited and preference is
> given to killing a child before parent.
It is very subtle approach. Consider the case when you have a pool of
threads/processes which are created and released on demand, there are
several such pools for different servers and you do know which one
will very likely being guilty.
Who should adjust the scores for newly created processes? Who should
check that processes in the first group have negative oom ajustment and
in the second group a positive value? Who determines when its time to
ajust the scores?
> > What I propose is the simplest way for the most
> > commonly used case.
>
> No, procfs is the correct interface for tuning oom kill preferences and
> not by name parsing.
>
> With oom_adj scores, you have the ability to specify oom kill preferences
> within a cpuset or memory controller as well, whereas oom_victim_name is
> global and very costly when not found in select_bad_process().
>
> > It is a help for the admin and not the force to
> > invent complex machinery which will be error-prone and hard to debug
> > when eventually oom happens.
>
> It's very simple to debug the oom killer's decisions, which is why I
> introduced /proc/sys/vm/oom_dump_tasks.
>
> It also requires two expensive scans of the entire tasklist (I introduced
> /proc/sys/vm/oom_kill_allocating_task specifically to avoid _one_
> expensive scan) when oom_victim_name isn't found.
It is not really costly, since most of the time we skip an entry and do
not lock the task and do not calculate its badness value. No one scares
that 'ps ax' is costly because it has to run through all the processes.
Messing with the scores is actually more expensive since we have to lock
the task and perform a calculus. I do not say it is wrong, but it is
much more complex task to being stable compared to simple task selection
by its name. It is what is used and what people expect to have (that's
actually why it was implemented :) and not to write some daemons to
monitor the clients and appropriate processes or change the code of the
servers.
--
Evgeniy Polyakov
next prev parent reply other threads:[~2009-01-13 11:54 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-12 15:33 Linux killed Kenny, bastard! Evgeniy Polyakov
2009-01-12 15:44 ` Dave Jones
2009-01-12 15:48 ` Evgeniy Polyakov
2009-01-12 15:51 ` Alan Cox
2009-01-12 15:52 ` Evgeniy Polyakov
2009-01-12 21:29 ` Chris Snook
2009-01-12 21:42 ` Evgeniy Polyakov
2009-01-13 13:52 ` [why oom_adj does not work] " Evgeniy Polyakov
2009-01-13 14:06 ` Alan Cox
2009-01-13 14:24 ` Evgeniy Polyakov
2009-01-13 15:00 ` Balbir Singh
2009-01-13 15:21 ` Evgeniy Polyakov
2009-01-13 18:04 ` Valdis.Kletnieks
2009-01-13 19:46 ` David Rientjes
2009-01-13 21:33 ` Evgeniy Polyakov
2009-01-13 21:39 ` David Rientjes
2009-01-13 22:05 ` Evgeniy Polyakov
2009-01-14 16:12 ` OOM documentation update [was: Linux killed Kenny, bastard!] Evgeniy Polyakov
2009-01-14 17:06 ` [take2] " Evgeniy Polyakov
2009-01-14 21:34 ` Randy Dunlap
2009-01-14 21:53 ` Bryan Donlan
2009-01-14 22:10 ` Evgeniy Polyakov
2009-01-14 22:14 ` [take3] " Evgeniy Polyakov
2009-01-15 0:58 ` David Rientjes
2009-01-15 8:51 ` Evgeniy Polyakov
2009-01-15 8:57 ` [take4] " Evgeniy Polyakov
2009-01-15 11:13 ` David Rientjes
2009-01-12 15:49 ` Linux killed Kenny, bastard! Alan Cox
2009-01-12 15:50 ` Evgeniy Polyakov
2009-01-12 15:52 ` Alan Cox
2009-01-12 15:56 ` Evgeniy Polyakov
2009-01-12 16:19 ` Alan Cox
2009-01-12 16:29 ` Evgeniy Polyakov
2009-01-12 23:00 ` Bill Davidsen
2009-01-12 23:17 ` Evgeniy Polyakov
2009-01-13 1:53 ` David Rientjes
2009-01-13 8:52 ` Evgeniy Polyakov
2009-01-13 9:54 ` David Rientjes
2009-01-13 11:54 ` Evgeniy Polyakov [this message]
2009-01-13 12:15 ` Alan Cox
2009-01-13 12:29 ` Evgeniy Polyakov
2009-01-13 13:19 ` Theodore Tso
2009-01-13 13:35 ` Evgeniy Polyakov
2009-01-14 0:24 ` Bill Davidsen
2009-01-14 0:35 ` Evgeniy Polyakov
2009-01-13 13:47 ` Alan Cox
2009-01-13 19:36 ` David Rientjes
2009-01-13 21:46 ` Evgeniy Polyakov
2009-01-13 22:49 ` Theodore Tso
2009-01-13 23:02 ` Evgeniy Polyakov
2009-01-14 1:11 ` Theodore Tso
2009-01-14 1:20 ` Evgeniy Polyakov
2009-01-14 4:06 ` Theodore Tso
2009-01-13 23:10 ` David Rientjes
2009-01-13 23:35 ` Evgeniy Polyakov
2009-01-13 23:43 ` David Rientjes
2009-01-13 23:55 ` Evgeniy Polyakov
2009-01-14 0:32 ` David Rientjes
2009-01-14 0:53 ` Evgeniy Polyakov
2009-01-14 4:23 ` Valdis.Kletnieks
2009-01-14 9:07 ` Evgeniy Polyakov
2009-01-13 19:15 ` David Rientjes
2009-01-13 22:00 ` Evgeniy Polyakov
2009-01-13 23:26 ` Valdis.Kletnieks
2009-01-13 23:36 ` Evgeniy Polyakov
2009-01-13 13:41 ` Jan-Frode Myklebust
2009-01-13 13:59 ` Alan Cox
2009-01-12 16:22 ` Dave Jones
2009-01-12 16:28 ` Evgeniy Polyakov
2009-01-13 16:35 ` KOSAKI Motohiro
2009-01-13 22:04 ` Evgeniy Polyakov
-- strict thread matches above, loose matches on Subject: below --
2009-01-13 10:58 Tomasz Chmielewski
2009-01-13 12:20 ` Evgeniy Polyakov
[not found] <bTxPW-1lH-13@gated-at.bofh.it>
[not found] ` <bTE53-5LJ-13@gated-at.bofh.it>
[not found] ` <bTEeI-5Y0-15@gated-at.bofh.it>
[not found] ` <bTGTe-1K5-3@gated-at.bofh.it>
[not found] ` <bTNi6-3kb-9@gated-at.bofh.it>
[not found] ` <bTOea-4QT-1@gated-at.bofh.it>
[not found] ` <bTQ6f-7Qs-1@gated-at.bofh.it>
[not found] ` <bTQpv-5o-3@gated-at.bofh.it>
[not found] ` <bTQzd-iK-5@gated-at.bofh.it>
[not found] ` <bTXhp-2IA-31@gated-at.bofh.it>
[not found] ` <bTZjb-62D-25@gated-at.bofh.it>
2009-01-17 15:21 ` Bodo Eggert
2009-01-17 15:41 ` Evgeniy Polyakov
2009-01-18 12:49 ` Bodo Eggert
2009-01-18 13:17 ` Evgeniy Polyakov
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=20090113115408.GA22289@ioremap.net \
--to=zbr@ioremap.net \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=davidsen@tmr.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rientjes@google.com \
--cc=torvalds@linux-foundation.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