linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Rientjes <rientjes@google.com>,
	Jakob Unterwurzacher <jakobunt@gmail.com>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.cz>
Subject: [PATCH 2/4] oom: Do not invoke oom notifiers on sysrq+f
Date: Wed,  8 Jul 2015 15:04:19 +0200	[thread overview]
Message-ID: <1436360661-31928-3-git-send-email-mhocko@suse.com> (raw)
In-Reply-To: <1436360661-31928-1-git-send-email-mhocko@suse.com>

From: Michal Hocko <mhocko@suse.cz>

A github user rfjakob has reported the following issue via IRC.
<rfjakob> Manually triggering the OOM killer does not work anymore in 4.0.5
<rfjakob> This is what it looks like: https://gist.github.com/rfjakob/346b7dc611fc3cdf4011
<rfjakob> Basically, what happens is that the GPU driver frees some memory, that satisfies the OOM killer
<rfjakob> But the memory is allocated immediately again, and in the, no processes are killed no matter how often you trigger the oom killer
<rfjakob> "in the end"

Quoting from the github:
"
[19291.202062] sysrq: SysRq : Manual OOM execution
[19291.208335] Purging GPU memory, 74399744 bytes freed, 8728576 bytes still pinned.
[19291.390767] sysrq: SysRq : Manual OOM execution
[19291.396792] Purging GPU memory, 74452992 bytes freed, 8728576 bytes still pinned.
[19291.560349] sysrq: SysRq : Manual OOM execution
[19291.566018] Purging GPU memory, 75489280 bytes freed, 8728576 bytes still pinned.
[19291.729944] sysrq: SysRq : Manual OOM execution
[19291.735686] Purging GPU memory, 74399744 bytes freed, 8728576 bytes still pinned.
[19291.918637] sysrq: SysRq : Manual OOM execution
[19291.924299] Purging GPU memory, 74403840 bytes freed, 8728576 bytes still pinned.
"

The issue is that sysrq+f (force_kill) gets confused by the regular OOM
heuristic which tries to prevent from OOM killer if some of the oom
notifier can relase a memory. The heuristic doesn't make much sense for
the sysrq+f path because this one is used by the administrator to kill
a memory hog.

Reported-by: Jakob Unterwurzacher <jakobunt@gmail.com>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
---
 mm/oom_kill.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index f2737d66f66a..0b1b0b25f928 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -661,10 +661,12 @@ bool out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
 	if (oom_killer_disabled)
 		return false;
 
-	blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
-	if (freed > 0)
-		/* Got some memory back in the last second. */
-		goto out;
+	if (!force_kill) {
+		blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
+		if (freed > 0)
+			/* Got some memory back in the last second. */
+			goto out;
+	}
 
 	/*
 	 * If current has a pending SIGKILL or is exiting, then automatically
-- 
2.1.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2015-07-08 13:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-08 13:04 [PATCH 0/4] oom: sysrq+f fixes + cleanups Michal Hocko
2015-07-08 13:04 ` [PATCH 1/4] oom: Do not panic when OOM killer is sysrq triggered Michal Hocko
2015-07-08 23:36   ` David Rientjes
2015-07-09  8:23     ` Michal Hocko
2015-07-09 21:03       ` David Rientjes
2015-07-10  7:41         ` Michal Hocko
2015-07-08 13:04 ` Michal Hocko [this message]
2015-07-08 23:37   ` [PATCH 2/4] oom: Do not invoke oom notifiers on sysrq+f David Rientjes
2015-07-09  8:55     ` Michal Hocko
2015-07-09 21:07       ` David Rientjes
2015-07-10  7:40         ` Michal Hocko
2015-07-14 21:58           ` David Rientjes
2015-07-15  9:42             ` Michal Hocko
2015-07-15 22:21               ` David Rientjes
2015-07-15 22:44               ` [patch -mm] mm, oom: move oom notifiers to page allocator David Rientjes
2015-07-16  7:12                 ` Michal Hocko
2015-07-08 13:04 ` [PATCH 3/4] mm, oom: organize oom context into struct Michal Hocko
2015-07-08 23:38   ` David Rientjes
2015-07-09  8:56     ` Michal Hocko
2015-07-09 21:09       ` David Rientjes
2015-07-08 13:04 ` [PATCH 4/4] oom: split out forced OOM killer Michal Hocko
2015-07-08 23:41   ` David Rientjes
2015-07-09 10:05     ` Michal Hocko
2015-07-09 21:27       ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436360661-31928-3-git-send-email-mhocko@suse.com \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=jakobunt@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox