[PATCH] kill_pid_info: kill acquired_tasklist_lock
Kill acquired_tasklist_lock, sig_needs_tasklist() is very cheap nowadays. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b963a8441c
commit
0c12b51712
@ -1119,19 +1119,18 @@ kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
|
|||||||
int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
|
int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
int acquired_tasklist_lock = 0;
|
|
||||||
struct task_struct *p;
|
struct task_struct *p;
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
if (unlikely(sig_needs_tasklist(sig))) {
|
if (unlikely(sig_needs_tasklist(sig)))
|
||||||
read_lock(&tasklist_lock);
|
read_lock(&tasklist_lock);
|
||||||
acquired_tasklist_lock = 1;
|
|
||||||
}
|
|
||||||
p = pid_task(pid, PIDTYPE_PID);
|
p = pid_task(pid, PIDTYPE_PID);
|
||||||
error = -ESRCH;
|
error = -ESRCH;
|
||||||
if (p)
|
if (p)
|
||||||
error = group_send_sig_info(sig, info, p);
|
error = group_send_sig_info(sig, info, p);
|
||||||
if (unlikely(acquired_tasklist_lock))
|
|
||||||
|
if (unlikely(sig_needs_tasklist(sig)))
|
||||||
read_unlock(&tasklist_lock);
|
read_unlock(&tasklist_lock);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
return error;
|
return error;
|
||||||
|
Loading…
Reference in New Issue
Block a user