linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Yafang Shao <laoar.shao@gmail.com>,
	 Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	 Andrew Morton <akpm@linux-foundation.org>,
	 Johannes Weiner <hannes@cmpxchg.org>,
	Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH v2] memcg, oom: check memcg margin for parallel oom
Date: Thu, 16 Jul 2020 13:04:43 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.23.453.2007161254000.3086260@chino.kir.corp.google.com> (raw)
In-Reply-To: <20200716071240.GD31089@dhcp22.suse.cz>

On Thu, 16 Jul 2020, Michal Hocko wrote:

> > It's not possible to present data because we've had such a check for years 
> > in our fleet so I can't say that it has prevented X unnecessary oom kills 
> > compared to doing the check prior to calling out_of_memory().  I'm hoping 
> > that can be understood.
> > 
> > Since Yafang is facing the same issue, and there is no significant 
> > downside to doing the mem_cgroup_margin() check prior to 
> > oom_kill_process() (or checking task_will_free_mem(current)), and it's 
> > acknowledged that it *can* prevent unnecessary oom killing, which is a 
> > very good thing, I'd like to understand why such resistance to it.
> 
> Because exactly this kind of arguments has led to quite some "should be
> fine" heuristics which kicked back: do not kill exiting task, sacrifice
> child instead of a victim just to name few. All of them make some sense
> from a glance but they can serious kick back as the experience has
> thought us.
> 
> Really, I do not see what is so hard to understand that each heuristic,
> especially those to subtle areas like oom definitely is, needs data to
> justify them. We are running this for years is really not an argument.
> Sure arguing that your workload leads to x amount of false positives
> and just shifting the check to later saves y amount of them sounds like
> a relevant argument to me.
> 

Deferring the go/no-go decision on the oom kill to the very last moment 
doesn't seem like a heuristic, I think it's an inherent responsibility of 
the kernel to do whatever necessary to prevent a userspace process from 
being oom killed (and the way to solve Yafang's issue that we had solved 
years ago).  That can be done by closing the window as much as possible 
(including within out_of_memory()) to reduce the likelihood of unnecessary 
oom killing.  It's intuitive and seems rather trivial.

I would understand an argument against such an approach if it added 
elaborate complexity, but this isn't doing so.  If the decision was 
already made in oom_kill_process(), I don't think anybody would advocate 
for moving it below out_of_memory() to its current state.  We aren't 
losing anything here, we are only preventing unnecessary oom killing that 
has caused issues for Yafang as well as us.

Any solution that does a mem_cgroup_margin() check before out_of_memory() 
in the memcg path is closing that window a little bit, but I think we can 
do better.


  reply	other threads:[~2020-07-16 20:04 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 13:57 [PATCH v2] memcg, oom: check memcg margin for parallel oom Yafang Shao
2020-07-14 14:05 ` Michal Hocko
2020-07-14 14:30 ` Chris Down
2020-07-14 18:46 ` David Rientjes
2020-07-15  1:44   ` Yafang Shao
2020-07-15  2:44     ` David Rientjes
2020-07-15  3:10       ` Yafang Shao
2020-07-15  3:18         ` David Rientjes
2020-07-15  3:31           ` Yafang Shao
2020-07-15 17:30             ` David Rientjes
2020-07-16  2:38               ` Yafang Shao
2020-07-16  7:04                 ` David Rientjes
2020-07-16 11:53                   ` Yafang Shao
2020-07-16 12:21                     ` Michal Hocko
2020-07-16 13:09                       ` Tetsuo Handa
2020-07-16 19:53                     ` David Rientjes
2020-07-17  1:35                       ` Yafang Shao
2020-07-17 19:26                         ` David Rientjes
2020-07-18  2:15                           ` Yafang Shao
2020-07-16  5:54               ` Tetsuo Handa
2020-07-16  6:11                 ` Michal Hocko
2020-07-16  7:06                   ` David Rientjes
2020-07-16  6:08               ` Michal Hocko
2020-07-16  6:56                 ` David Rientjes
2020-07-16  7:12                   ` Michal Hocko
2020-07-16 20:04                     ` David Rientjes [this message]
2020-07-28 18:04                   ` Johannes Weiner
2020-07-15  6:56         ` Michal Hocko

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=alpine.DEB.2.23.453.2007161254000.3086260@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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).