pids: Compute task_tgid using signal->leader_pid
The cost is the the same and this removes the need to worry about complications that come from de_thread and group_leader changing. __task_pid_nr_ns has been updated to take advantage of this change. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
15
kernel/pid.c
15
kernel/pid.c
@@ -421,13 +421,14 @@ pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
|
||||
if (!ns)
|
||||
ns = task_active_pid_ns(current);
|
||||
if (likely(pid_alive(task))) {
|
||||
if (type != PIDTYPE_PID) {
|
||||
if (type == __PIDTYPE_TGID)
|
||||
type = PIDTYPE_PID;
|
||||
|
||||
task = task->group_leader;
|
||||
}
|
||||
nr = pid_nr_ns(rcu_dereference(task->pids[type].pid), ns);
|
||||
struct pid *pid;
|
||||
if (type == PIDTYPE_PID)
|
||||
pid = task_pid(task);
|
||||
else if (type == __PIDTYPE_TGID)
|
||||
pid = task_tgid(task);
|
||||
else
|
||||
pid = rcu_dereference(task->group_leader->pids[type].pid);
|
||||
nr = pid_nr_ns(pid, ns);
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
|
Reference in New Issue
Block a user