Re: [RFC PATCH v2 7/8] signal: add task_group_leader()

From: Oleg Nesterov

Date: Sat Dec 05 2026 - 10:30:12 EST


On 12/05, Chris Mason wrote:
>
> +static inline struct task_struct *task_group_leader(const struct task_struct *p)
> +{
> + RCU_LOCKDEP_WARN(p->signal != current->signal &&
> + !rcu_read_lock_any_held() &&
> + !lockdep_tasklist_lock_is_held(),
> + "another process's leader needs RCU or tasklist_lock");
> +
> + return READ_ONCE(p->group_leader);

perhaps rcu_dereference_raw() makes more sense...

> static inline struct task_struct *next_thread(struct task_struct *p)
> {
> - return __next_thread(p) ?: p->group_leader;
> + return __next_thread(p) ?: task_group_leader(p);

Well. next_thread() should not use task_group_leader(). I'll send
the patch...

Oleg.