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


Groups > linux.kernel > #1690645

Re: [PATCH] oom_reaper: close race without using oom_lock

From Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Newsgroups linux.kernel
Subject Re: [PATCH] oom_reaper: close race without using oom_lock
Date 2017-07-18 23:00 +0200
Message-ID <u4HL4-7dn-19@gated-at.bofh.it> (permalink)
References <u4Bmh-3oI-11@gated-at.bofh.it> <u4BvX-3ta-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Michal Hocko wrote:
> On Tue 18-07-17 23:06:50, Tetsuo Handa wrote:
> > Commit e2fe14564d3316d1 ("oom_reaper: close race with exiting task")
> > guarded whole OOM reaping operations using oom_lock. But there was no
> > need to guard whole operations. We needed to guard only setting of
> > MMF_OOM_REAPED flag because get_page_from_freelist() in
> > __alloc_pages_may_oom() is called with oom_lock held.
> > 
> > If we change to guard only setting of MMF_OOM_SKIP flag, the OOM reaper
> > can start reaping operations as soon as wake_oom_reaper() is called.
> > But since setting of MMF_OOM_SKIP flag at __mmput() is not guarded with
> > oom_lock, guarding only the OOM reaper side is not sufficient.
> > 
> > If we change the OOM killer side to ignore MMF_OOM_SKIP flag once,
> > there is no need to guard setting of MMF_OOM_SKIP flag, and we can
> > guarantee a chance to call get_page_from_freelist() in
> > __alloc_pages_may_oom() without depending on oom_lock serialization.
> > 
> > This patch makes MMF_OOM_SKIP act as if MMF_OOM_REAPED, and adds a new
> > flag which acts as if MMF_OOM_SKIP, in order to close both race window
> > (the OOM reaper side and __mmput() side) without using oom_lock.
> 
> Why do we need this patch when
> http://lkml.kernel.org/r/20170626130346.26314-1-mhocko@kernel.org
> already removes the lock and solves another problem at once?

We haven't got an answer from Hugh and/or Andrea whether that patch is safe.
Even if that patch is safe, this patch still helps with CONFIG_MMU=n case.

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


Thread

[PATCH] oom_reaper: close race without using oom_lock Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-18 16:10 +0200
  Re: [PATCH] oom_reaper: close race without using oom_lock Michal Hocko <mhocko@kernel.org> - 2017-07-18 16:20 +0200
    Re: [PATCH] oom_reaper: close race without using oom_lock Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-18 23:00 +0200
      Re: [PATCH] oom_reaper: close race without using oom_lock Michal Hocko <mhocko@kernel.org> - 2017-07-20 16:20 +0200
        Re: [PATCH] oom_reaper: close race without using oom_lock Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-20 23:50 +0200
          Re: [PATCH] oom_reaper: close race without using oom_lock Michal Hocko <mhocko@kernel.org> - 2017-07-21 17:10 +0200
            Re: [PATCH] oom_reaper: close race without using oom_lock Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-21 17:20 +0200
              Re: [PATCH] oom_reaper: close race without using oom_lock Michal Hocko <mhocko@kernel.org> - 2017-07-21 17:40 +0200
                Re: [PATCH] oom_reaper: close race without using oom_lock Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-23 02:50 +0200
                Re: [PATCH] oom_reaper: close race without using oom_lock Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-23 05:10 +0200
                Re: [PATCH] oom_reaper: close race without using oom_lock Michal Hocko <mhocko@kernel.org> - 2017-07-24 08:40 +0200
                Re: [PATCH] oom_reaper: close race without using oom_lock Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2017-07-26 13:40 +0200
                Re: [PATCH] oom_reaper: close race without using oom_lock Michal Hocko <mhocko@kernel.org> - 2017-07-26 13:50 +0200
  Re: [PATCH] oom_reaper: close race without using oom_lock Johannes Weiner <hannes@cmpxchg.org> - 2017-07-18 16:20 +0200

csiph-web