Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1307837

[RFC 1/3] oom, sysrq: Skip over oom victims and killed tasks

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject [RFC 1/3] oom, sysrq: Skip over oom victims and killed tasks
Date 2016-01-12 22:10 +0100
Message-ID <qQemv-6vy-29@gated-at.bofh.it> (permalink)
References <qQemu-6vy-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Michal Hocko <mhocko@suse.com>

When the OOM killer is issued by the administrator by sysrq+f it is
expected that a task will be killed to release the memory pressure.
Unlike the regular OOM killer the forced one doesn't abort when
there is an OOM victim selected. Instead oom_scan_process_thread
forces select_bad_process to check this thread. If this happens to be
the largest OOM hog then it will be selected again and the forced
OOM killer wouldn't make any change in case the current OOM victim
is not able terminate and free up resources it is sitting on.

This patch makes sure that the forced oom killer will skip over all
oom victims (with TIF_MEMDIE) and tasks with fatal_signal_pending
on basis that there is no guarantee those tasks are making progress
and there is no way to check they will ever make any. It is more
conservative to simply try another task.

Signed-off-by: Michal Hocko <mhocko@suse.com>
---
 mm/oom_kill.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index abefeeb42504..2b9dc5129a89 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -326,6 +326,17 @@ static struct task_struct *select_bad_process(struct oom_control *oc,
 		case OOM_SCAN_OK:
 			break;
 		};
+
+		/*
+		 * If we are doing sysrq+f then it doesn't make any sense to
+		 * check OOM victim or killed task because it might be stuck
+		 * and unable to terminate while the forced OOM might be the
+		 * only option left to get the system back to work.
+		 */
+		if (is_sysrq_oom(oc) && (test_tsk_thread_flag(p, TIF_MEMDIE) ||
+				fatal_signal_pending(p)))
+			continue;
+
 		points = oom_badness(p, NULL, oc->nodemask, totalpages);
 		if (!points || points < chosen_points)
 			continue;
-- 
2.6.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 0/3] oom: few enahancements Michal Hocko <mhocko@kernel.org> - 2016-01-12 22:10 +0100
  [RFC 2/3] oom: Do not sacrifice already OOM killed children Michal Hocko <mhocko@kernel.org> - 2016-01-12 22:10 +0100
    Re: [RFC 2/3] oom: Do not sacrifice already OOM killed children David Rientjes <rientjes@google.com> - 2016-01-13 01:50 +0100
      Re: [RFC 2/3] oom: Do not sacrifice already OOM killed children Michal Hocko <mhocko@kernel.org> - 2016-01-13 10:40 +0100
        Re: [RFC 2/3] oom: Do not sacrifice already OOM killed children David Rientjes <rientjes@google.com> - 2016-01-14 01:50 +0100
  [RFC 1/3] oom, sysrq: Skip over oom victims and killed tasks Michal Hocko <mhocko@kernel.org> - 2016-01-12 22:10 +0100
    Re: [RFC 1/3] oom, sysrq: Skip over oom victims and killed tasks David Rientjes <rientjes@google.com> - 2016-01-13 01:50 +0100
      Re: [RFC 1/3] oom, sysrq: Skip over oom victims and killed tasks Michal Hocko <mhocko@kernel.org> - 2016-01-13 10:40 +0100
        Re: [RFC 1/3] oom, sysrq: Skip over oom victims and killed tasks David Rientjes <rientjes@google.com> - 2016-01-14 01:40 +0100
          Re: [RFC 1/3] oom, sysrq: Skip over oom victims and killed tasks Michal Hocko <mhocko@kernel.org> - 2016-01-14 12:10 +0100
            Re: [RFC 1/3] oom, sysrq: Skip over oom victims and killed tasks David Rientjes <rientjes@google.com> - 2016-01-14 23:00 +0100
  [RFC 3/3] oom: Do not try to sacrifice small children Michal Hocko <mhocko@kernel.org> - 2016-01-12 22:10 +0100
    Re: [RFC 3/3] oom: Do not try to sacrifice small children David Rientjes <rientjes@google.com> - 2016-01-13 02:00 +0100
      Re: [RFC 3/3] oom: Do not try to sacrifice small children Michal Hocko <mhocko@kernel.org> - 2016-01-13 10:50 +0100
        Re: [RFC 3/3] oom: Do not try to sacrifice small children David Rientjes <rientjes@google.com> - 2016-01-14 01:50 +0100

csiph-web