Thread (64 messages) 64 messages, 4 authors, 2016-03-17
STALE3760d

[PATCH 3.1/5] oom: make oom_reaper freezable

From: Michal Hocko <mhocko@kernel.org>
Date: 2016-02-15 20:40:17
Also in: lkml
Subsystem: memory management, memory management - oom killer, the rest · Maintainers: Andrew Morton, Michal Hocko, Linus Torvalds

Andrew,
this can be either folded into 3/5 patch or go as a standalone one. I
would be inclined to have it standalone for the record (the description
should be pretty clear about the intention) and because the issue is
highly unlikely. OOM during the PM freezer doesn't happen in 99% cases.

On Sat 06-02-16 23:33:24, Tetsuo Handa wrote:
Michal Hocko wrote:
[...]
quoted
OK, I was thinking about it some more and it seems you are right here.
oom_reaper as a kernel thread is not freezable automatically and so it
might interfere after all the processes/kernel threads are considered
frozen. Then it really might shut down TIF_MEMDIE too early and wake out
oom_killer_disable. wait_event_freezable is not sufficient because the
oom_reaper might running while the PM freezer is freezing tasks and it
will miss it because it doesn't see it.
I'm not using PM freezer, but your answer is opposite to my guess.
I thought try_to_freeze_tasks(false) is called by freeze_kernel_threads()
after oom_killer_disable() succeeded, and try_to_freeze_tasks(false) will
freeze both userspace tasks (including OOM victims which got TIF_MEMDIE
cleared by the OOM reaper) and kernel threads (including the OOM reaper).
kernel threads which are not freezable are ignored by the freezer.
Thus, I was guessing that clearing TIF_MEMDIE without reaching do_exit() is
safe.
Does the following explains it better?
---
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help