linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] preparation for merging the OOM reaper
@ 2016-02-17 10:28 Tetsuo Handa
  2016-02-17 10:29 ` [PATCH 1/6] mm,oom: exclude TIF_MEMDIE processes from candidates Tetsuo Handa
                   ` (5 more replies)
  0 siblings, 6 replies; 29+ messages in thread
From: Tetsuo Handa @ 2016-02-17 10:28 UTC (permalink / raw)
  To: mhocko, akpm
  Cc: rientjes, mgorman, oleg, torvalds, hughd, andrea, riel, linux-mm,
	linux-kernel

I am posting this patchset for smoothly merging the OOM reaper without
worrying about corner cases. This patchset also applies cleanly on top of
the current Linus tree because this patchset is meant for applying before
merging the OOM reaper.

Several problems were found in oom reaper v5 patchset
( http://lkml.kernel.org/r/1454505240-23446-1-git-send-email-mhocko@kernel.org ).

(1) "[PATCH 3/5] oom: clear TIF_MEMDIE after oom_reaper managed to unmap
    the address space" was added in order to allow the OOM killer select
    next OOM victim by marking current OOM victim OOM-unkillable after the
    OOM reaper reaped current OOM victim's memory. But it was found that
    threads created by clone(!CLONE_SIGHAND && CLONE_VM) disable further
    OOM reaping because next OOM victim is sharing current OOM victim's
    memory and only current OOM victim is marked OOM-unkillable. While it
    would be possible to mark all processes sharing current OOM victim's
    memory OOM-unkillable, we are not trying to traverse the process list.
    ( http://lkml.kernel.org/r/201602042322.IAG65142.MOOJHFSVLOQFFt@I-love.SAKURA.ne.jp )

(2) It was found that clearing TIF_MEMDIE does not allow the OOM killer
    select next OOM victim if current OOM victim got stuck between getting
    PF_EXITING and doing victim's mm = NULL. Since it is possible that we
    hit silent OOM livelock before we select current OOM victim, we should
    fix it before merging the OOM reaper.
    ( http://lkml.kernel.org/r/20160111165214.GA32132@cmpxchg.org )

(3) "[PATCH 5/5] mm, oom_reaper: implement OOM victims queuing" was added
    in order to allow more robust queuing in case multiple OOM events occur
    in short period. But it was found that this queuing approach did not
    take into account oom_kill_allocating_task = 1 case which does not wait
    for existing TIF_MEMDIE threads to clear TIF_MEMDIE. Since this is a bug
    of the OOM killer rather than a bug of the OOM reaper, we should fix it
    before merging the OOM reaper.
    ( http://lkml.kernel.org/r/201602162011.ECG52697.VOLJFtOQHFMSFO@I-love.SAKURA.ne.jp )

(4) There is a very strong collision between Michal Hocko and Tetsuo Handa.
    Michal wants to merge the OOM reaper as soon as possible and correct
    corner cases afterward because this is not an urgent problem. Tetsuo
    wants to stop lying as soon as possible by papering over corner cases
    for now because this is "either address now or too late to address"
    problem, for this problem can annoy customers and technical staffs at
    support center (Tetsuo was working there) for next 10 years unless
    this problem is fixed before the DEADLINE (the day customers decide
    the distributor's specific kernel version to use for their systems).
    If we don't want to merge a mechanism for warning silent OOM livelock
    problems (e.g. kmallocwd), Tetsuo really wants to get rid of all
    possible locations that can cause silent OOM livelock problems.

This patchset does the following things.

  "[PATCH 1/6] mm,oom: exclude TIF_MEMDIE processes from candidates."
  allows SysRq-f to select !TIF_MEMDIE process which fixes a bug in
  current kernels.

  "[PATCH 2/6] mm,oom: don't abort on exiting processes when selecting
  a victim." fixes a problem (2) explained above.

  "[PATCH 3/6] mm,oom: exclude oom_task_origin processes if they are
  OOM victims." fixes a problem similar to (2) explained above.

  "[PATCH 4/6] mm,oom: exclude oom_task_origin processes if they are
  OOM-unkillable." fixes a problem similar to (2) explained above.

  "[PATCH 5/6] mm,oom: Re-enable OOM killer using timers." mitigates
  a problem (1) explained above, by allowing the kernel ignore existing
  TIF_MEMDIE threads when OOM livelock is detected by timer based
  heuristics.

  "[PATCH 6/6] mm,oom: wait for OOM victims when using
  oom_kill_allocating_task == 1" fixes a problem (3) explained above.

By applying this patchset prior to applying the OOM reaper patchset,
we can start the OOM reaper without correcting problems found in
"[PATCH 3/5] oom: clear TIF_MEMDIE after oom_reaper managed to unmap
the address space" and "[PATCH 5/5] mm, oom_reaper: implement OOM
victims queuing".

 oom_kill.c |   71 +++++++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 51 insertions(+), 20 deletions(-)

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2016-04-09 14:04 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-17 10:28 [PATCH 0/6] preparation for merging the OOM reaper Tetsuo Handa
2016-02-17 10:29 ` [PATCH 1/6] mm,oom: exclude TIF_MEMDIE processes from candidates Tetsuo Handa
2016-02-17 12:41   ` Michal Hocko
2016-02-17 16:40     ` Tetsuo Handa
2016-02-17 17:33       ` Michal Hocko
2016-02-17 20:55         ` Tetsuo Handa
2016-02-17 10:30 ` [PATCH 2/6] mm,oom: don't abort on exiting processes when selecting a victim Tetsuo Handa
2016-02-17 12:54   ` Michal Hocko
2016-02-17 13:07     ` Tetsuo Handa
2016-02-17 14:00       ` Michal Hocko
2016-02-17 14:39         ` Tetsuo Handa
2016-02-17 15:01           ` Michal Hocko
2016-02-17 15:29             ` Tetsuo Handa
2016-02-17 16:17               ` Michal Hocko
2016-02-18 11:21                 ` Tetsuo Handa
2016-02-17 10:32 ` [PATCH 3/6] mm,oom: exclude oom_task_origin processes if they are OOM victims Tetsuo Handa
2016-02-17 13:02   ` Michal Hocko
2016-02-17 10:33 ` [PATCH 4/6] mm,oom: exclude oom_task_origin processes if they are OOM-unkillable Tetsuo Handa
2016-02-17 13:10   ` Michal Hocko
2016-02-17 13:36     ` Tetsuo Handa
2016-02-17 13:44       ` Michal Hocko
2016-02-17 10:34 ` [PATCH 5/6] mm,oom: Re-enable OOM killer using timers Tetsuo Handa
2016-02-17 13:20   ` Michal Hocko
2016-04-09 14:00     ` Tetsuo Handa
2016-04-09 14:04       ` Tetsuo Handa
2016-02-17 10:36 ` [PATCH 6/6] mm,oom: wait for OOM victims when using oom_kill_allocating_task == 1 Tetsuo Handa
2016-02-17 13:32   ` Michal Hocko
2016-02-18 10:45     ` Tetsuo Handa
2016-02-18 12:20       ` Michal Hocko

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).