[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190423201955.GX3923@linux.ibm.com>
Date: Tue, 23 Apr 2019 13:19:55 -0700
From: "Paul E. McKenney" <paulmck@...ux.ibm.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Nicholas Piggin <npiggin@...il.com>,
LKMM Maintainers -- Akira Yokosawa <akiyks@...il.com>,
Andrea Parri <andrea.parri@...rulasolutions.com>,
Boqun Feng <boqun.feng@...il.com>,
David Howells <dhowells@...hat.com>,
Daniel Lustig <dlustig@...dia.com>,
Jade Alglave <j.alglave@....ac.uk>,
Kernel development list <linux-kernel@...r.kernel.org>,
Luc Maranget <luc.maranget@...ia.fr>,
Alan Stern <stern@...land.harvard.edu>,
Will Deacon <will.deacon@....com>
Subject: Re: [PATCH] Documentation: atomic_t.txt: Explain ordering provided
by smp_mb__{before,after}_atomic()
On Tue, Apr 23, 2019 at 03:40:03PM +0200, Peter Zijlstra wrote:
> On Tue, Apr 23, 2019 at 06:30:10AM -0700, Paul E. McKenney wrote:
> > There are a great many that look like this:
> >
> > smp_mb__before_atomic();
> > clear_bit(NFSD4_CLIENT_UPCALL_LOCK, &clp->cl_flags);
> > smp_mb__after_atomic();
>
> Ooh, marvel at the comment describing the ordering there. Oh wait :-(
> So much for checkpatch.pl I suppose.
Especially if the code was in the kernel before checkpatch.pl started
asking for comments. Which might or might not be the case with this
code. No idea either way.
> I think the first is a release order for the 'LOCK' bit and the second
> is because of wake_up_bit() being a shitty interface.
>
> So maybe that should've been:
>
> clear_bit_unlock(NFSD4_CLIENT_UPCALL_LOCK, &clp->cl_flags);
> smp_mb__after_atomic();
> wake_up_bit(&clp->cl_flags, NFSD4_CLIENT_UPCALL_LOCK);
>
> instead?
Quite possibly, but my brain is too fried to be sure.
Thanx, Paul
Powered by blists - more mailing lists