The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.8.x-ovz" and will appear
at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.8.6
------>
commit 315f2cf7428d49d724775f01c545926c55b39a7e
Author: Vladimir Davydov <[email protected]>
Date: Thu Oct 15 17:47:33 2015 +0400
ms/oom: don't count on mm-less current process
Patchset description: oom enhancements - part 1
Pull mainstream patches that clean up TIF_MEMDIE handling. They will
come in handy for the upcoming oom rework.
https://jira.sw.ru/browse/PSBM-26973
David Rientjes (1):
mm, oom: remove unnecessary exit_state check
Johannes Weiner (1):
mm: oom_kill: clean up victim marking and exiting interfaces
Michal Hocko (3):
oom: make sure that TIF_MEMDIE is set under task_lock
oom: add helpers for setting and clearing TIF_MEMDIE
oom: thaw the OOM victim if it is frozen
Tetsuo Handa (1):
oom: don't count on mm-less current process
===============================================
This patch desciption:
From: Tetsuo Handa <[email protected]>
out_of_memory() doesn't trigger the OOM killer if the current task is
already exiting or it has fatal signals pending, and gives the task
access to memory reserves instead. However, doing so is wrong if
out_of_memory() is called by an allocation (e.g. from exit_task_work())
after the current task has already released its memory and cleared
TIF_MEMDIE at exit_mm(). If we again set TIF_MEMDIE to post-exit_mm()
current task, the OOM killer will be blocked by the task sitting in the
final schedule() waiting for its parent to reap it. It will trigger an
OOM livelock if its parent is unable to reap it due to doing an
allocation and waiting for the OOM killer to kill it.
Signed-off-by: Tetsuo Handa <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
(cherry picked from commit d7a94e7e11badf8404d40b41e008c3131a3cebe3)
Signed-off-by: Vladimir Davydov <[email protected]>
Reviewed-by: Kirill Tkhai <[email protected]>
Conflicts:
mm/oom_kill.c
---
mm/oom_kill.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 57d9f3e..fd9e13d 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -643,8 +643,12 @@ void out_of_memory(struct zonelist *zonelist, gfp_t
gfp_mask,
* If current has a pending SIGKILL or is exiting, then automatically
* select it. The goal is to allow it to allocate so that it may
* quickly exit and free its memory.
+ *
+ * But don't select if current has already released its mm and cleared
+ * TIF_MEMDIE flag at exit_mm(), otherwise an OOM livelock may occur.
*/
- if (fatal_signal_pending(current) || current->flags & PF_EXITING) {
+ if (current->mm &&
+ (fatal_signal_pending(current) || current->flags & PF_EXITING)) {
set_thread_flag(TIF_MEMDIE);
return;
}
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel