Re: [PATCH v2 3/4] task: With a grace period after finish_task_switch, remove unnecessary code

From: Paul E. McKenney
Date: Sun Sep 15 2019 - 14:47:27 EST


On Sun, Sep 15, 2019 at 10:07:24AM -0700, Linus Torvalds wrote:
> On Sun, Sep 15, 2019 at 7:32 AM Paul E. McKenney <paulmck@xxxxxxxxxx> wrote:
> >
> > First, what am I looking for?
> >
> > I am looking for something that prevents the following:
> >
> > o Task A acquires a reference to Task B's task_struct while
> > protected only by RCU, and is just about to increment ->rcu_users
> > when it is delayed. Maybe its vCPU is preempted or something.
>
> Where exactly do you see "increment ->rcu_users"
>
> There are _no_ users that can increment rcu_users. The thing is
> initialized to '2' when the process is created, and nobody ever
> increments it. EVER.
>
> It's only ever decremented, and when it hits zero we know that both
> users are gone, and we start the rcu-delayed free.

Color me blind and apologies for the noise!

Thanx, Paul