[Devel] [PATCH RHEL7 COMMIT] ms/mm, oom: remove unnecessary exit_state check

Konstantin Khorenko khorenko at virtuozzo.com
Thu Oct 15 06:47:32 PDT 2015


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 d2dc55df7ee5b44dac752c1ff02e2ae5ce251935
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Thu Oct 15 17:47:32 2015 +0400

    ms/mm, oom: remove unnecessary exit_state check
    
    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: David Rientjes <rientjes at google.com>
    
    The oom killer scans each process and determines whether it is eligible
    for oom kill or whether the oom killer should abort because of
    concurrent memory freeing.  It will abort when an eligible process is
    found to have TIF_MEMDIE set, meaning it has already been oom killed and
    we're waiting for it to exit.
    
    Processes with task->mm == NULL should not be considered because they
    are either kthreads or have already detached their memory and killing
    them would not lead to memory freeing.  That memory is only freed after
    exit_mm() has returned, however, and not when task->mm is first set to
    NULL.
    
    Clear TIF_MEMDIE after exit_mm()'s mmput() so that an oom killed process
    is no longer considered for oom kill, but only until exit_mm() has
    returned.  This was fragile in the past because it relied on
    exit_notify() to be reached before no longer considering TIF_MEMDIE
    processes.
    
    Signed-off-by: David Rientjes <rientjes at google.com>
    Cc: Oleg Nesterov <oleg at redhat.com>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
    (cherry picked from commit fb794bcbb4e5552242f9a4c5e1ffe4c6da29a968)
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    
    Reviewed-by: Kirill Tkhai <ktkhai at odin.com>
---
 kernel/exit.c | 1 +
 mm/oom_kill.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index dbc8f77..90feb5f 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -520,6 +520,7 @@ static void exit_mm(struct task_struct * tsk)
 	task_unlock(tsk);
 	mm_update_next_owner(mm);
 	mmput(mm);
+	clear_thread_flag(TIF_MEMDIE);
 }
 
 /*
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 5413a44..57d9f3e 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -258,8 +258,6 @@ enum oom_scan_t oom_scan_process_thread(struct task_struct *task,
 		unsigned long totalpages, const nodemask_t *nodemask,
 		bool force_kill, bool ignore_memcg_guarantee)
 {
-	if (task->exit_state)
-		return OOM_SCAN_CONTINUE;
 	if (oom_unkillable_task(task, NULL, nodemask))
 		return OOM_SCAN_CONTINUE;
 



More information about the Devel mailing list