Re: [PATCH v7 2/3] sched/task: Add the put_task_struct_atomic_safe() function

From: Peter Zijlstra
Date: Thu May 04 2023 - 11:31:58 EST


On Thu, May 04, 2023 at 05:23:07PM +0200, Oleg Nesterov wrote:
> On 05/04, Wander Lairson Costa wrote:
> >
> > On Thu, May 4, 2023 at 11:34 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> > >
> > > static inline void put_task_struct(struct task_struct *t)
> > > {
> > > if (!refcount_dec_and_test(&t->usage))
> > > return;
> > >
> > > if (IS_ENABLED(CONFIG_PREEMPT_RT) && !preemptible())
> > > call_rcu(&t->rcu, __put_task_struct_rcu);
> > >
> > > __put_task_struct(t);
> > > }
> > >
> >
> > That's what v5 [1] does.
>
> Yes, but as Sebastian explained CONFIG_PROVE_RAW_LOCK_NESTING won't like it.

This can help:

https://lkml.kernel.org/r/168303194177.404.8610123576035502891.tip-bot2@tip-bot2