From: Michal Hocko <mhocko@kernel.org>
To: David Rientjes <rientjes@google.com>
Cc: linux-mm@kvack.org,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC 3/3] oom: Do not try to sacrifice small children
Date: Wed, 13 Jan 2016 10:40:34 +0100 [thread overview]
Message-ID: <20160113094034.GC28942@dhcp22.suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.10.1601121646410.28831@chino.kir.corp.google.com>
On Tue 12-01-16 16:51:43, David Rientjes wrote:
> On Tue, 12 Jan 2016, Michal Hocko wrote:
>
> > diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> > index 8bca0b1e97f7..b5c0021c6462 100644
> > --- a/mm/oom_kill.c
> > +++ b/mm/oom_kill.c
> > @@ -721,8 +721,16 @@ try_to_sacrifice_child(struct oom_control *oc, struct task_struct *victim,
> > if (!child_victim)
> > goto out;
> >
> > - put_task_struct(victim);
> > - victim = child_victim;
> > + /*
> > + * Protecting the parent makes sense only if killing the child
> > + * would release at least some memory (at least 1MB).
> > + */
> > + if (K(victim_points) >= 1024) {
> > + put_task_struct(victim);
> > + victim = child_victim;
> > + } else {
> > + put_task_struct(child_victim);
> > + }
> >
> > out:
> > return victim;
>
> The purpose of sacrificing a child has always been to prevent a process
> that has been running with a substantial amount of work done from being
> terminated and losing all that work if it can be avoided. This happens a
> lot: imagine a long-living front end client forking a child which simply
> collects stats and malloc information at a regular intervals and writes
> them out to disk or over the network. These processes may be quite small,
> and we're willing to happily sacrifice them if it will save the parent.
> This was, and still is, the intent of the sacrifice in the first place.
Yes I understand the intention of the heuristic. I am just contemplating
about what is way too small to sacrifice because it clearly doesn't make
much sense to kill a task which is sitting on basically no memory (well
just few pages backing page tables and stack) because this would just
prolong the OOM agony.
> We must be able to deal with oom victims that are very small, since
> userspace has complete control in prioritizing these processes in the
> first place.
Sure the patch is not great but I would like to come up with some
threshold when children are way too small to be worthwhile considering.
Or maybe there is other measure we can use.
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-01-13 9:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-12 21:00 [RFC 0/3] oom: few enahancements Michal Hocko
2016-01-12 21:00 ` [RFC 1/3] oom, sysrq: Skip over oom victims and killed tasks Michal Hocko
2016-01-13 0:41 ` David Rientjes
2016-01-13 9:30 ` Michal Hocko
2016-01-14 0:38 ` David Rientjes
2016-01-14 11:00 ` Michal Hocko
2016-01-14 21:51 ` David Rientjes
2016-01-15 10:12 ` Michal Hocko
2016-01-15 15:37 ` One Thousand Gnomes
2016-01-19 23:01 ` David Rientjes
2016-01-19 22:57 ` David Rientjes
2016-01-20 9:49 ` Michal Hocko
2016-01-21 0:01 ` David Rientjes
2016-01-21 9:15 ` Michal Hocko
2016-01-12 21:00 ` [RFC 2/3] oom: Do not sacrifice already OOM killed children Michal Hocko
2016-01-13 0:45 ` David Rientjes
2016-01-13 9:36 ` Michal Hocko
2016-01-14 0:42 ` David Rientjes
2016-01-12 21:00 ` [RFC 3/3] oom: Do not try to sacrifice small children Michal Hocko
2016-01-13 0:51 ` David Rientjes
2016-01-13 9:40 ` Michal Hocko [this message]
2016-01-14 0:43 ` David Rientjes
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=20160113094034.GC28942@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=rientjes@google.com \
/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;
as well as URLs for NNTP newsgroup(s).