linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>, Michal Hocko <mhocko@suse.cz>,
	linux-mm@kvack.org
Subject: [patch v2] oom: thaw threads if oom killed thread is frozen before deferring
Date: Fri, 7 Oct 2011 19:59:49 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1110071958200.13992@chino.kir.corp.google.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1110071954040.13992@chino.kir.corp.google.com>

If a thread has been oom killed and is frozen, thaw it before returning
to the page allocator.  Otherwise, it can stay frozen indefinitely and
no memory will be freed.

Reported-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 v2: adds the missing header file include, the resend patch was based on a 
     previous patch from Michal that is no longer needed if this is 
     applied.

 mm/oom_kill.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 626303b..d897262 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -32,6 +32,7 @@
 #include <linux/mempolicy.h>
 #include <linux/security.h>
 #include <linux/ptrace.h>
+#include <linux/freezer.h>
 
 int sysctl_panic_on_oom;
 int sysctl_oom_kill_allocating_task;
@@ -317,8 +318,11 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
 		 * blocked waiting for another task which itself is waiting
 		 * for memory. Is there a better alternative?
 		 */
-		if (test_tsk_thread_flag(p, TIF_MEMDIE))
+		if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
+			if (unlikely(frozen(p)))
+				thaw_process(p);
 			return ERR_PTR(-1UL);
+		}
 		if (!p->mm)
 			continue;
 

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-10-08  2:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-08  2:56 [patch resend] " David Rientjes
2011-10-08  2:59 ` David Rientjes [this message]
2011-10-08  7:23   ` [patch v2] " KOSAKI Motohiro
2011-10-11  6:33     ` Michal Hocko
2011-10-11 14:50       ` KOSAKI Motohiro
2011-10-11 15:14         ` Michal Hocko
2011-10-11 15:57           ` KOSAKI Motohiro
2011-10-11 19:07             ` Michal Hocko
2011-10-11 23:36       ` David Rientjes
2011-10-11 23:39         ` Tejun Heo
2011-10-11 23:46           ` David Rientjes
2011-10-12  6:50         ` Michal Hocko
2011-10-12  6:58           ` Michal Hocko
2011-10-11 19:16 ` [patch resend] " Oleg Nesterov
2011-10-11 23:30   ` David Rientjes
2011-10-11 23:41     ` Andrew Morton
2011-10-12 14:40     ` Oleg Nesterov

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=alpine.DEB.2.00.1110071958200.13992@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=oleg@redhat.com \
    --cc=rjw@sisk.pl \
    /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