linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
To: rientjes@google.com
Cc: mhocko@kernel.org, akpm@linux-foundation.org,
	aarcange@redhat.com, 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: Wed, 25 Apr 2018 06:57:59 +0900	[thread overview]
Message-ID: <201804250657.GFI21363.StOJHOQFOMFVFL@I-love.SAKURA.ne.jp> (raw)
In-Reply-To: <alpine.DEB.2.21.1804232231020.82340@chino.kir.corp.google.com>

David Rientjes wrote:
> On Tue, 24 Apr 2018, Tetsuo Handa wrote:
> 
> > > > We can call __oom_reap_task_mm() from exit_mmap() (or __mmput()) before
> > > > exit_mmap() holds mmap_sem for write. Then, at least memory which could
> > > > have been reclaimed if exit_mmap() did not hold mmap_sem for write will
> > > > be guaranteed to be reclaimed before MMF_OOM_SKIP is set.
> > > > 
> > > 
> > > I think that's an exceptionally good idea and will mitigate the concerns 
> > > of others.
> > > 
> > > It can be done without holding mm->mmap_sem in exit_mmap() and uses the 
> > > same criteria that the oom reaper uses to set MMF_OOM_SKIP itself, so we 
> > > don't get dozens of unnecessary oom kills.
> > > 
> > > What do you think about this?  It passes preliminary testing on powerpc 
> > > and I'm enqueued it for much more intensive testing.  (I'm wishing there 
> > > was a better way to acknowledge your contribution to fixing this issue, 
> > > especially since you brought up the exact problem this is addressing in 
> > > previous emails.)
> > > 
> > 
> > I don't think this patch is safe, for exit_mmap() is calling
> > mmu_notifier_invalidate_range_{start,end}() which might block with oom_lock
> > held when oom_reap_task_mm() is waiting for oom_lock held by exit_mmap().
> 
> One of the reasons that I extracted __oom_reap_task_mm() out of the new 
> oom_reap_task_mm() is to avoid the checks that would be unnecessary when 
> called from exit_mmap().  In this case, we can ignore the 
> mm_has_blockable_invalidate_notifiers() check because exit_mmap() has 
> already done mmu_notifier_release().  So I don't think there's a concern 
> about __oom_reap_task_mm() blocking while holding oom_lock.  Unless you 
> are referring to something else?

Oh, mmu_notifier_release() made mm_has_blockable_invalidate_notifiers() == false. OK.

But I want comments why it is safe; I will probably miss that dependency
when we move that code next time.

  reply	other threads:[~2018-04-24 21:58 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
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                             ` Tetsuo Handa [this message]
2018-04-24 22:25                               ` [patch v2] mm, oom: fix concurrent munlock and oom reaper unmap 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=201804250657.GFI21363.StOJHOQFOMFVFL@I-love.SAKURA.ne.jp \
    --to=penguin-kernel@i-love.sakura.ne.jp \
    --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@kernel.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