[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190327150402.GX4102@linux.ibm.com>
Date: Wed, 27 Mar 2019 08:04:02 -0700
From: "Paul E. McKenney" <paulmck@...ux.ibm.com>
To: NeilBrown <neilb@...e.com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
Thomas Graf <tgraf@...g.ch>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] rhashtable: use bit_spin_locks to protect hash
bucket.
On Wed, Mar 27, 2019 at 09:35:18AM +1100, NeilBrown wrote:
> On Tue, Mar 26 2019, Herbert Xu wrote:
>
> > On Mon, Mar 25, 2019 at 04:05:39PM +1100, NeilBrown wrote:
> >>
> >> + * Sometimes we unlock a bucket by writing a new pointer there. In that
> >> + * case we don't need to unlock, but we do need to reset state such as
> >> + * local_bh. For that we have rht_unlocked(). This doesn't include
> >> + * the memory barrier that bit_spin_unlock() provides, but rcu_assign_pointer()
> >> + * will have provided that.
> >
> > Hmm, are you sure that's enough? IIRC rcu_assign_pointer only
> > provides a write barrier compared to the more complete (but one-way)
> > barrier that a spin-lock provides.
> >
>
> The bit_spin_unlock(), which I am avoiding as unnecessary, would have
> provided release semantics.
> i.e. any write by this CPU that happened before the releasing write
> will be visible to other CPUs before (or when) they see the result of
> the releasing write.
> This is (as I understand it) exactly that rcu_assign_pointer() promises
> - even before acquire semantics were added as Paul just reported.
>
> So yes, I am sure (surer now that I've walked through it carefully).
But why not construct a litmus test and apply tools/memory-model? ;-)
Thanx, Paul
Powered by blists - more mailing lists