[Devel] [PATCH RHEL7 COMMIT] freezer: Do not freeze tasks killed by OOM killer

Vladimir Davydov vdavydov at virtuozzo.com
Tue Sep 8 08:30:57 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.8
------>
commit f10e9ae09fae910fa4f73c6b413b1afc1e42400a
Author: Cong Wang <xiyou.wangcong at gmail.com>
Date:   Tue Sep 8 19:30:57 2015 +0400

    freezer: Do not freeze tasks killed by OOM killer
    
    Since f660daac474c6f (oom: thaw threads if oom killed thread is frozen
    before deferring) OOM killer relies on being able to thaw a frozen task
    to handle OOM situation but a3201227f803 (freezer: make freezing() test
    freeze conditions in effect instead of TIF_FREEZE) has reorganized the
    code and stopped clearing freeze flag in __thaw_task. This means that
    the target task only wakes up and goes into the fridge again because the
    freezing condition hasn't changed for it. This reintroduces the bug
    fixed by f660daac474c6f.
    
    Fix the issue by checking for TIF_MEMDIE thread flag in
    freezing_slow_path and exclude the task from freezing completely. If a
    task was already frozen it would get woken by __thaw_task from OOM killer
    and get out of freezer after rechecking freezing().
    
    Changes since v1
    - put TIF_MEMDIE check into freezing_slowpath rather than in __refrigerator
      as per Oleg
    - return __thaw_task into oom_scan_process_thread because
      oom_kill_process will not wake task in the fridge because it is
      sleeping uninterruptible
    
    [mhocko at suse.cz: rewrote the changelog]
    Fixes: a3201227f803 (freezer: make freezing() test freeze conditions in effect instead of TIF_FREEZE)
    Cc: 3.3+ <stable at vger.kernel.org> # 3.3+
    Signed-off-by: Cong Wang <xiyou.wangcong at gmail.com>
    Signed-off-by: Michal Hocko <mhocko at suse.cz>
    Acked-by: Oleg Nesterov <oleg at redhat.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
    
    (cherry picked from commit 51fae6da640edf9d266c94f36bc806c63c301991)
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    Link: https://jira.sw.ru/browse/PSBM-38758
---
 kernel/freezer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/freezer.c b/kernel/freezer.c
index b462fa197517..f6da03862979 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -36,6 +36,9 @@ bool freezing_slow_path(struct task_struct *p)
 	if (p->flags & (PF_NOFREEZE | PF_SUSPEND_TASK))
 		return false;
 
+	if (test_thread_flag(TIF_MEMDIE))
+		return false;
+
 	if (pm_nosig_freezing || cgroup_freezing(p))
 		return true;
 



More information about the Devel mailing list