Skip to content

Commit d00f523

Browse files
oleg-nesterovbrauner
authored andcommitted
pid: change task_state() to use task_ppid_nr_ns()
to simplify the code. Note that only tpid and max_fds really need rcu_read_lock(), we could move task_ppid_nr_ns/task_tgid_nr_ns/task_numa_group_id/get_task_cred outside of rcu read section. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Link: https://lore.kernel.org/20250810173620.GA20007@redhat.com Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent b1afcad commit d00f523

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

fs/proc/array.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,11 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
157157
unsigned int max_fds = 0;
158158

159159
rcu_read_lock();
160-
ppid = pid_alive(p) ?
161-
task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
162-
163160
tracer = ptrace_parent(p);
164161
if (tracer)
165162
tpid = task_pid_nr_ns(tracer, ns);
166163

164+
ppid = task_ppid_nr_ns(p, ns);
167165
tgid = task_tgid_nr_ns(p, ns);
168166
ngid = task_numa_group_id(p);
169167
cred = get_task_cred(p);

0 commit comments

Comments
 (0)