]> git.baikalelectronics.ru Git - kernel.git/commit
freezer: Do not freeze tasks killed by OOM killer
authorCong Wang <xiyou.wangcong@gmail.com>
Tue, 21 Oct 2014 07:27:12 +0000 (09:27 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 21 Oct 2014 21:44:20 +0000 (23:44 +0200)
commit854e24294fc7d1a08d7a27a0f0859017313a3e4c
treecec42bbe9f90849dc466e37e79ce72504345c921
parent794664fc5e82534aa444b079f807e339c4d8d9b5
freezer: Do not freeze tasks killed by OOM killer

Since e4fa9b9abef298 (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 9a01316a9184 (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 e4fa9b9abef298.

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@suse.cz: rewrote the changelog]
Fixes: 9a01316a9184 (freezer: make freezing() test freeze conditions in effect instead of TIF_FREEZE)
Cc: 3.3+ <stable@vger.kernel.org> # 3.3+
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/freezer.c