Skip to content

Commit

Permalink
signal: oom_kill_task: use SEND_SIG_FORCED instead of force_sig()
Browse files Browse the repository at this point in the history
Change oom_kill_task() to use do_send_sig_info(SEND_SIG_FORCED) instead
of force_sig(SIGKILL).  With the recent changes we do not need force_ to
kill the CLONE_NEWPID tasks.

And this is more correct.  force_sig() can race with the exiting thread
even if oom_kill_task() checks p->mm != NULL, while
do_send_sig_info(group => true) kille the whole process.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Mar 23, 2012
1 parent def8cf7 commit d2d3930
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,11 @@ static void oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
pr_err("Kill process %d (%s) sharing same memory\n",
task_pid_nr(p), p->comm);
task_unlock(p);
force_sig(SIGKILL, p);
do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true);
}

set_tsk_thread_flag(victim, TIF_MEMDIE);
force_sig(SIGKILL, victim);
do_send_sig_info(SIGKILL, SEND_SIG_FORCED, victim, true);
}
#undef K

Expand Down

0 comments on commit d2d3930

Please sign in to comment.