[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250810173620.GA20007@redhat.com>
Date: Sun, 10 Aug 2025 19:36:20 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Christian Brauner <brauner@...nel.org>,
高翔 <gaoxiang17@...omi.com>
Cc: Al Viro <viro@...iv.linux.org.uk>, Mateusz Guzik <mjguzik@...il.com>,
Xiang Gao <gxxa03070307@...il.com>, linux-kernel@...r.kernel.org
Subject: [PATCH 4/4] 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@...hat.com>
---
fs/proc/array.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/proc/array.c b/fs/proc/array.c
index d6a0369caa93..69269745d73b 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -157,13 +157,11 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
unsigned int max_fds = 0;
rcu_read_lock();
- ppid = pid_alive(p) ?
- task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
-
tracer = ptrace_parent(p);
if (tracer)
tpid = task_pid_nr_ns(tracer, ns);
+ ppid = task_ppid_nr_ns(p, ns);
tgid = task_tgid_nr_ns(p, ns);
ngid = task_numa_group_id(p);
cred = get_task_cred(p);
--
2.25.1.362.g51ebf55
Powered by blists - more mailing lists