Skip to content

Commit

Permalink
kill_pid_info: don't take now unneeded tasklist_lock
Browse files Browse the repository at this point in the history
Previously handle_stop_signal(SIGCONT) could drop ->siglock.  That is why
kill_pid_info(SIGCONT) takes tasklist_lock to make sure the target task can't
go away after unlock.  Not needed now.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Cc: Jiri Kosina <jkosina@suse.cz>
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 Apr 30, 2008
1 parent e442055 commit 6ca25b5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
2 changes: 0 additions & 2 deletions include/linux/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,6 @@ int unhandled_signal(struct task_struct *tsk, int sig);
#define sig_kernel_stop(sig) \
(((sig) < SIGRTMIN) && siginmask(sig, SIG_KERNEL_STOP_MASK))

#define sig_needs_tasklist(sig) ((sig) == SIGCONT)

#define sig_user_defined(t, signr) \
(((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_DFL) && \
((t)->sighand->action[(signr)-1].sa.sa_handler != SIG_IGN))
Expand Down
7 changes: 1 addition & 6 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,9 +1039,6 @@ int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
struct task_struct *p;

rcu_read_lock();
if (unlikely(sig_needs_tasklist(sig)))
read_lock(&tasklist_lock);

retry:
p = pid_task(pid, PIDTYPE_PID);
if (p) {
Expand All @@ -1055,10 +1052,8 @@ int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
*/
goto retry;
}

if (unlikely(sig_needs_tasklist(sig)))
read_unlock(&tasklist_lock);
rcu_read_unlock();

return error;
}

Expand Down

0 comments on commit 6ca25b5

Please sign in to comment.