Linux-mm Archive on
 help / color / Atom feed
From: Michal Hocko <>
To: Andrew Morton <>
Cc: David Rientjes <>,
	Miao Xie <>,
	"Rafael J. Wysocki" <>,, LKML <>,, Michal Hocko <>
Subject: [PATCH 1/2] freezer, oom: check TIF_MEMDIE on the correct task
Date: Mon, 27 Jun 2016 14:15:18 +0200
Message-ID: <> (raw)
In-Reply-To: <>

From: Michal Hocko <>

freezing_slow_path is checking TIF_MEMDIE to skip OOM killed
tasks. It is, however, checking the flag on the current task rather than
the given one. This is really confusing because freezing() can be called
also on !current tasks. It would end up working correctly for its main
purpose because __refrigerator will be always called on the current task
so the oom victim will never get frozen. But it could lead to surprising
results when a task which is freezing a cgroup got oom killed because
only part of the cgroup would get frozen. This is highly unlikely but
worth fixing as the resulting code would be more clear anyway.

Signed-off-by: Michal Hocko <>
 kernel/freezer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/freezer.c b/kernel/freezer.c
index a8900a3bc27a..6f56a9e219fa 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -42,7 +42,7 @@ bool freezing_slow_path(struct task_struct *p)
 	if (p->flags & (PF_NOFREEZE | PF_SUSPEND_TASK))
 		return false;
-	if (test_thread_flag(TIF_MEMDIE))
+	if (test_tsk_thread_flag(p, TIF_MEMDIE))
 		return false;
 	if (pm_nosig_freezing || cgroup_freezing(p))

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

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27 12:15 [PATCH 0/2] TIF_MEMDIE usage fixlet Michal Hocko
2016-06-27 12:15 ` Michal Hocko [this message]
2016-06-27 21:17   ` [PATCH 1/2] freezer, oom: check TIF_MEMDIE on the correct task Rafael J. Wysocki
2016-06-27 12:15 ` [PATCH 2/2] cpuset, mm: fix TIF_MEMDIE check in cpuset_change_task_nodemask Michal Hocko

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-mm Archive on

Archives are clonable:
	git clone --mirror linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ \
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone