[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZCRiXrQQRNy2aJAS@lothringen>
Date: Wed, 29 Mar 2023 18:07:58 +0200
From: Frederic Weisbecker <frederic@...nel.org>
To: "Paul E. McKenney" <paulmck@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, rcu <rcu@...r.kernel.org>,
Uladzislau Rezki <urezki@...il.com>,
Neeraj Upadhyay <quic_neeraju@...cinc.com>,
Boqun Feng <boqun.feng@...il.com>,
Joel Fernandes <joel@...lfernandes.org>
Subject: Re: [PATCH 1/4] rcu/nocb: Protect lazy shrinker against concurrent
(de-)offloading
On Sun, Mar 26, 2023 at 02:45:18PM -0700, Paul E. McKenney wrote:
> On Sun, Mar 26, 2023 at 10:01:34PM +0200, Frederic Weisbecker wrote:
> > > > > > /* Snapshot count of all CPUs */
> > > > > > for_each_possible_cpu(cpu) {
> > > > > > struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu);
> > > > > > - int _count = READ_ONCE(rdp->lazy_len);
> > > > > > + int _count;
> > > > > > +
> > > > > > + if (!rcu_rdp_is_offloaded(rdp))
> > > > > > + continue;
> > > > >
> > > > > If the CPU is offloaded, isn't ->lazy_len guaranteed to be zero?
> > > > >
> > > > > Or can it contain garbage after a de-offloading operation?
> > > >
> > > > If it's deoffloaded, ->lazy_len is indeed (supposed to be) guaranteed to be zero.
> > > > Bypass is flushed and disabled atomically early on de-offloading and the
> > > > flush resets ->lazy_len.
> > >
> > > Whew! At the moment, I don't feel strongly about whether or not
> > > the following code should (1) read the value, (2) warn on non-zero,
> > > (3) assume zero without reading, or (4) some other option that is not
> > > occurring to me. Your choice!
> >
> > (2) looks like a good idea!
>
> Sounds good to me!
So since we now iterate rcu_nocb_mask after the patchset, there is no more
deoffloaded rdp to check. Meanwhile I put a WARN in the new series making
sure that an rdp in rcu_nocb_mask is also offloaded (heh!)
Powered by blists - more mailing lists