linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: rientjes@google.com, akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm, oom: don't invoke oom killer if current has been reapered
Date: Mon, 13 Jul 2020 08:01:54 +0200	[thread overview]
Message-ID: <20200713060154.GA16783@dhcp22.suse.cz> (raw)
In-Reply-To: <1594437481-11144-1-git-send-email-laoar.shao@gmail.com>

On Fri 10-07-20 23:18:01, Yafang Shao wrote:
> If the current's MMF_OOM_SKIP is set, it means that the current is exiting
> or dying and likely to realease its address space.

That is not actually true. The primary reason for this flag is to tell
that the task is no longer relevant for the oom victim selection because
most of its memory has been released. But the task might be stuck at
many places and waiting for it to terminate might easily lockup the
system.

The design of the oom reaper is to guarantee a forward progress if when
the victim cannot make a forward progress on its own. For that to work
the oom killer cannot relly rely on the victim's state or that it would
finish.

If you remove this fundamental assumption then the oom killer can lockup
again.

> So we don't need to
> invoke the oom killer again. Otherwise that may cause some unexpected
> issues, for example, bellow is the issue found in our production
> environment.

Please see the above.

> There're many threads of a multi-threaded task parallel running in a
> container on many cpus. Then many threads triggered OOM at the same time,
> 
> CPU-1	        CPU-2         ...        CPU-n
> thread-1        thread-2      ...        thread-n
> 
> wait oom_lock   wait oom_lock ...        hold oom_lock
> 
>                                          (sigkill received)
> 
>                                          select current as victim
>                                          and wakeup oom reaper
> 
>                                          release oom_lock
> 
>                                          (MMF_OOM_SKIP set by oom reaper)
> 
>                                          (lots of pages are freed)
> hold oom_lock

Could you be more specific please? The page allocator never waits for
the oom_lock and keeps retrying instead. Also __alloc_pages_may_oom
tries to allocate with the lock held.

Could you provide oom reports please?
-- 
Michal Hocko
SUSE Labs


  parent reply	other threads:[~2020-07-13  6:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-11  3:18 [PATCH] mm, oom: don't invoke oom killer if current has been reapered Yafang Shao
2020-07-11  5:37 ` Yafang Shao
2020-07-13  6:01 ` Michal Hocko [this message]
2020-07-13  6:21   ` Michal Hocko
2020-07-13 12:24     ` Yafang Shao
2020-07-13 12:45       ` Michal Hocko
2020-07-13 13:11         ` Yafang Shao
2020-07-13 19:05           ` Michal Hocko
2020-07-14  0:15             ` Tetsuo Handa
2020-07-14  0:18               ` Tetsuo Handa
2020-07-14  2:09             ` Yafang Shao
2020-07-13 23:50 ` Tetsuo Handa
2020-07-14  2:13   ` Yafang Shao
2020-07-14  2:42     ` Tetsuo Handa
2020-07-14  2:58       ` Yafang Shao
2020-07-14  4:06         ` Tetsuo Handa
2020-07-14  5:03           ` Yafang Shao
2020-07-14  6:51           ` Michal Hocko
2020-07-14  6:43   ` Michal Hocko
2020-07-14  9:30     ` Yafang Shao

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=20200713060154.GA16783@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-mm@kvack.org \
    --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).