From: David Rientjes <rientjes@google.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Roman Gushchin <guro@fb.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch v2] mm, oom: fix concurrent munlock and oom reaper unmap
Date: Tue, 17 Apr 2018 22:20:24 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.21.1804172204420.123546@chino.kir.corp.google.com> (raw)
In-Reply-To: <201804180447.w3I4lq60017956@www262.sakura.ne.jp>
On Wed, 18 Apr 2018, Tetsuo Handa wrote:
> > Commit 97b1255cb27c is referencing MMF_OOM_SKIP already being set by
> > exit_mmap(). The only thing this patch changes is where that is done:
> > before or after free_pgtables(). We can certainly move it to before
> > free_pgtables() at the risk of subsequent (and eventually unnecessary) oom
> > kills. It's not exactly the point of this patch.
> >
> > I have thousands of real-world examples where additional processes were
> > oom killed while the original victim was in free_pgtables(). That's why
> > we've moved the MMF_OOM_SKIP to after free_pgtables().
>
> "we have moved"? No, not yet. Your patch is about to move it.
>
I'm referring to our own kernel, we have thousands of real-world examples
where additional processes have been oom killed where the original victim
is in free_pgtables(). It actually happens about 10-15% of the time in
automated testing where you create a 128MB memcg, fork a canary, and then
fork a >128MB memory hog. 10-15% of the time both processes get oom
killed: the memory hog first (higher rss), the canary second. The pgtable
stat is unchanged between oom kills.
> My question is: is it guaranteed that munlock_vma_pages_all()/unmap_vmas()/free_pgtables()
> by exit_mmap() are never blocked for memory allocation. Note that exit_mmap() tries to unmap
> all pages while the OOM reaper tries to unmap only safe pages. If there is possibility that
> munlock_vma_pages_all()/unmap_vmas()/free_pgtables() by exit_mmap() are blocked for memory
> allocation, your patch will introduce an OOM livelock.
>
If munlock_vma_pages_all(), unmap_vmas(), or free_pgtables() require
memory to make forward progress, then we have bigger problems :)
I just ran a query of real-world oom kill logs that I have. In 33,773,705
oom kills, I have no evidence of a thread failing to exit after reaching
exit_mmap().
You may recall from my support of your patch to emit the stack trace when
the oom reaper fails, in https://marc.info/?l=linux-mm&m=152157881518627,
that I have logs of 28,222,058 occurrences of the oom reaper where it
successfully frees memory and the victim exits.
If you'd like to pursue the possibility that exit_mmap() blocks before
freeing memory that we have somehow been lucky to miss in 33 million
occurrences, I'd appreciate the test case.
next prev parent reply other threads:[~2018-04-18 5:20 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 22:46 [patch] " David Rientjes
2018-04-18 0:57 ` Tetsuo Handa
2018-04-18 2:39 ` David Rientjes
2018-04-18 2:52 ` [patch v2] " David Rientjes
2018-04-18 3:55 ` Tetsuo Handa
2018-04-18 4:11 ` David Rientjes
2018-04-18 4:47 ` Tetsuo Handa
2018-04-18 5:20 ` David Rientjes [this message]
2018-04-18 7:50 ` Michal Hocko
2018-04-18 11:49 ` Tetsuo Handa
2018-04-18 11:58 ` Michal Hocko
2018-04-18 13:25 ` Tetsuo Handa
2018-04-18 13:44 ` Michal Hocko
2018-04-18 14:28 ` Tetsuo Handa
2018-04-18 19:14 ` David Rientjes
2018-04-19 6:35 ` Michal Hocko
2018-04-19 10:45 ` Tetsuo Handa
2018-04-19 11:04 ` Michal Hocko
2018-04-19 11:51 ` Tetsuo Handa
2018-04-19 12:48 ` Michal Hocko
2018-04-19 19:14 ` David Rientjes
2018-04-19 19:34 ` David Rientjes
2018-04-19 22:13 ` Tetsuo Handa
2018-04-20 8:23 ` Michal Hocko
2018-04-20 12:40 ` Michal Hocko
2018-04-22 3:22 ` David Rientjes
2018-04-22 3:48 ` [patch v2] mm, oom: fix concurrent munlock and oom reaperunmap Tetsuo Handa
2018-04-22 13:08 ` Michal Hocko
2018-04-24 2:31 ` David Rientjes
2018-04-24 5:11 ` Tetsuo Handa
2018-04-24 5:35 ` David Rientjes
2018-04-24 21:57 ` [patch v2] mm, oom: fix concurrent munlock and oom reaper unmap Tetsuo Handa
2018-04-24 22:25 ` David Rientjes
2018-04-24 22:34 ` [patch v3 for-4.17] " David Rientjes
2018-04-24 23:19 ` Michal Hocko
2018-04-24 13:04 ` [patch v2] mm, oom: fix concurrent munlock and oom reaperunmap Michal Hocko
2018-04-24 20:01 ` David Rientjes
2018-04-24 20:13 ` Michal Hocko
2018-04-24 20:22 ` David Rientjes
2018-04-24 20:31 ` Michal Hocko
2018-04-24 21:07 ` David Rientjes
2018-04-24 23:08 ` Michal Hocko
2018-04-24 23:14 ` Michal Hocko
2018-04-22 3:45 ` [patch v2] mm, oom: fix concurrent munlock and oom reaper unmap David Rientjes
2018-04-22 13:18 ` Michal Hocko
2018-04-23 16:09 ` 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.21.1804172204420.123546@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=guro@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--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