Linux-mm Archive on
 help / color / Atom feed
From: Michal Hocko <>
To: Andrew Morton <>
Cc: Oleg Nesterov <>,
	Tetsuo Handa <>,
	David Rientjes <>,, LKML <>,
	Michal Hocko <>
Subject: [PATCH] mm, oom_reaper: do not use siglock in try_oom_reaper
Date: Tue, 31 May 2016 09:23:43 +0200
Message-ID: <> (raw)

From: Michal Hocko <>

Oleg has noted that siglock usage in try_oom_reaper is both pointless
and dangerous. signal_group_exit can be checked lockless. The problem
is that sighand becomes NULL in __exit_signal so we can crash.

Fixes: 3ef22dfff239 ("oom, oom_reaper: try to reap tasks which skip regular OOM killer path")
Suggested-by: Oleg Nesterov <>
Signed-off-by: Michal Hocko <>
Hi Andrew,
Oleg has noticed this while reviewing
this should go in 4.7.

 mm/oom_kill.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index e01cc3e2e755..25eac62c190c 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -625,8 +625,6 @@ void try_oom_reaper(struct task_struct *tsk)
 	if (atomic_read(&mm->mm_users) > 1) {
 		for_each_process(p) {
-			bool exiting;
 			if (!process_shares_mm(p, mm))
 			if (fatal_signal_pending(p))
@@ -636,10 +634,7 @@ void try_oom_reaper(struct task_struct *tsk)
 			 * If the task is exiting make sure the whole thread group
 			 * is exiting and cannot acces mm anymore.
-			spin_lock_irq(&p->sighand->siglock);
-			exiting = signal_group_exit(p->signal);
-			spin_unlock_irq(&p->sighand->siglock);
-			if (exiting)
+			if (signal_group_exit(p->signal))
 			/* Give up */

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: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31  7:23 Michal Hocko [this message]
2016-05-31 21:25 ` 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:

* 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