Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1666660

Re: [patch] mm, oom: prevent additional oom kills before memory is freed

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [patch] mm, oom: prevent additional oom kills before memory is freed
Date 2017-06-15 13:10 +0200
Message-ID <tSAP0-1J4-13@gated-at.bofh.it> (permalink)
References <tSqcV-3gS-1@gated-at.bofh.it> <tSAvD-1ng-5@gated-at.bofh.it> <tSAFk-1qG-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu 15-06-17 19:53:24, Tetsuo Handa wrote:
> Michal Hocko wrote:
> > On Wed 14-06-17 16:43:03, David Rientjes wrote:
> > > If mm->mm_users is not incremented because it is already zero by the oom
> > > reaper, meaning the final refcount has been dropped, do not set
> > > MMF_OOM_SKIP prematurely.
> > > 
> > > __mmput() may not have had a chance to do exit_mmap() yet, so memory from
> > > a previous oom victim is still mapped.
> > 
> > true and do we have a _guarantee_ it will do it? E.g. can somebody block
> > exit_aio from completing? Or can somebody hold mmap_sem and thus block
> > ksm_exit resp. khugepaged_exit from completing? The reason why I was
> > conservative and set such a mm as MMF_OOM_SKIP was because I couldn't
> > give a definitive answer to those questions. And we really _want_ to
> > have a guarantee of a forward progress here. Killing an additional
> > proecess is a price to pay and if that doesn't trigger normall it sounds
> > like a reasonable compromise to me.
> 
> Right. If you want this patch, __oom_reap_task_mm() must not return true without
> setting MMF_OOM_SKIP (in other words, return false if __oom_reap_task_mm()
> does not set MMF_OOM_SKIP). The most important role of the OOM reaper is to
> guarantee that the OOM killer is re-enabled within finite time, for __mmput()
> cannot guarantee that MMF_OOM_SKIP is set within finite time.

An alternative would be to allow reaping and exit_mmap race. The unmap
part should just work I guess. We just have to be careful to not race
with free_pgtables and that shouldn't be too hard to implement (e.g.
(ab)use mmap_sem for write there). I haven't thought that through
completely though so I might miss something of course.
-- 
Michal Hocko
SUSE Labs

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[patch] mm, oom: prevent additional oom kills before memory is  freed David Rientjes <rientjes@google.com> - 2017-06-15 01:50 +0200
  Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Michal Hocko <mhocko@kernel.org> - 2017-06-15 12:50 +0200
    Re: [patch] mm, oom: prevent additional oom kills before memory is freed Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-06-15 13:00 +0200
      Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Michal Hocko <mhocko@kernel.org> - 2017-06-15 13:10 +0200
        Re: [patch] mm, oom: prevent additional oom kills before memory is freed Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-06-15 13:40 +0200
          Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Michal Hocko <mhocko@kernel.org> - 2017-06-15 14:10 +0200
            Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Michal Hocko <mhocko@kernel.org> - 2017-06-15 14:20 +0200
              Re: [patch] mm, oom: prevent additional oom kills before memory is freed Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-06-15 15:10 +0200
                Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Michal Hocko <mhocko@kernel.org> - 2017-06-15 15:30 +0200
                Re: [patch] mm, oom: prevent additional oom kills before memory is freed Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-06-15 23:50 +0200
                Re: [patch] mm, oom: prevent additional oom kills before memory is  freed David Rientjes <rientjes@google.com> - 2017-06-15 23:40 +0200
        Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Michal Hocko <mhocko@kernel.org> - 2017-06-15 14:30 +0200
    Re: [patch] mm, oom: prevent additional oom kills before memory is  freed David Rientjes <rientjes@google.com> - 2017-06-15 23:30 +0200
      Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Michal Hocko <mhocko@kernel.org> - 2017-06-15 23:50 +0200
        Re: [patch] mm, oom: prevent additional oom kills before memory is  freed David Rientjes <rientjes@google.com> - 2017-06-16 00:10 +0200
          Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Michal Hocko <mhocko@kernel.org> - 2017-06-16 00:20 +0200
            Re: [patch] mm, oom: prevent additional oom kills before memory is  freed David Rientjes <rientjes@google.com> - 2017-06-16 00:50 +0200
              Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Michal Hocko <mhocko@kernel.org> - 2017-06-16 10:10 +0200
            Re: Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> - 2017-06-16 03:00 +0200
              Re: [patch] mm, oom: prevent additional oom kills before memory is freed Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> - 2017-06-16 06:10 +0200
              Re: Re: [patch] mm, oom: prevent additional oom kills before memory  is freed Michal Hocko <mhocko@kernel.org> - 2017-06-16 10:40 +0200
                Re: Re: [patch] mm, oom: prevent additional oom kills before memory is freed Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-06-16 12:30 +0200
                Re: Re: [patch] mm, oom: prevent additional oom kills before memory  is freed Michal Hocko <mhocko@kernel.org> - 2017-06-16 13:10 +0200
                Re: Re: [patch] mm, oom: prevent additional oom kills before memoryis freed Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-06-16 16:30 +0200
                Re: Re: [patch] mm, oom: prevent additional oom kills before  memoryis freed Michal Hocko <mhocko@kernel.org> - 2017-06-16 16:50 +0200
                Re: Re: [patch] mm, oom: prevent additional oom kills before memory is freed Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-06-17 15:40 +0200
        Re: [patch] mm, oom: prevent additional oom kills before memory is freed Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-06-16 14:30 +0200
          Re: [patch] mm, oom: prevent additional oom kills before memory is  freed Michal Hocko <mhocko@kernel.org> - 2017-06-16 16:20 +0200
            [PATCH] mm,oom_kill: Close race window of needlessly selecting new victims. Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-06-17 07:20 +0200

csiph-web