Re: [PATCH 1/3] task: Add a count of task rcu users

From: Oleg Nesterov
Date: Wed Sep 04 2019 - 10:36:40 EST


On 09/02, Eric W. Biederman wrote:
>
> @@ -900,10 +900,9 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
> - /*
> - * One for us, one for whoever does the "release_task()" (usually
> - * parent)
> - */
> + /* One for the user space visible state that goes away when reaped. */
> + refcount_set(&tsk->rcu_users, 1);

forgot to mention...

This is minor, but we don't really need to initialize child->rcu_users in
dup_task_struct(), we can just add

.rcu_users = REFCOUNT_INIT(2),

into init_task's initializer.

Until we have a refcount_inc(task->rcu_users) user, of course.

Oleg.