linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yafang Shao <laoar.shao@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: Michal Hocko <mhocko@kernel.org>,
	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: Wed, 15 Jul 2020 11:31:35 +0800	[thread overview]
Message-ID: <CALOAHbDpoFzR-jeDbTLUzQSE-nU+F3BXNLXJgX-07EUJq6+woA@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.23.453.2007142016240.2667860@chino.kir.corp.google.com>

On Wed, Jul 15, 2020 at 11:18 AM David Rientjes <rientjes@google.com> wrote:
>
> On Wed, 15 Jul 2020, Yafang Shao wrote:
>
> > > It has successfully resolved it for several years in our kernel, we tried
> > > an approach similiar to yours but saw many instances where memcg oom kills
> > > continued to proceed even though the memcg information dumped to the
> > > kernel log showed memory available.
> > >
> > > If this was a page or two that became available due to memory freeing,
> > > it's not a significant difference.  Instead, if this races with an oom
> > > notification and a process exiting or being SIGKILL'd, it becomes much
> > > harder to explain to a user why their process was oom killed when there
> > > are tens of megabytes of memory available as shown by the kernel log (the
> > > freeing/exiting happened during a particularly long iteration of processes
> > > attached to the memcg, for example).
> > >
> > > That's what motivated a change to moving this to out_of_memory() directly,
> > > we found that it prevented even more unnecessary oom kills, which is a
> > > very good thing.  It may only be easily observable and make a significant
> > > difference at very large scale, however.
> > >
> >
> > Thanks for the clarification.
> >
> > If it is the race which causes this issue and we want to reduce the
> > race window, I don't know whether it is proper to check the memcg
> > margin in out_of_memory() or  do it before calling do_send_sig_info().
> > Because per my understanding, dump_header() always takes much more
> > time than select_bad_process() especially if there're slow consoles.
> > So the race might easily happen when doing dump_header()  or dumping
> > other information, but if we check the memcg margin after dumping this
> > oom info, it would be strange to dump so much oom logs without killing
> > a process.
> >
>
> Absolutely correct :)  In my proposed patch, we declare dump_header() as
> the "point of no return" since we don't want to dump oom kill information
> to the kernel log when nothing is actually killed.  We could abort at the
> very last minute, as you mention, but I think that may have an adverse
> impact on anything that cares about that log message.

How about storing the memcg information in oom_control when the memcg
oom is triggered, and then show this information in dump_header() ?
IOW, the OOM info really shows the memcg status when oom occurs,
rather than the memcg status when this info is printed.

-- 
Thanks
Yafang


  reply	other threads:[~2020-07-15  3:32 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 [this message]
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
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=CALOAHbDpoFzR-jeDbTLUzQSE-nU+F3BXNLXJgX-07EUJq6+woA@mail.gmail.com \
    --to=laoar.shao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.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).