linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 3/3] arch: Introduce smp_load_acquire(), smp_store_release()
       [not found] ` <20131107164503.325138873@infradead.org>
@ 2013-11-23  1:32   ` Paul E. McKenney
  0 siblings, 0 replies; only message in thread
From: Paul E. McKenney @ 2013-11-23  1:32 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: linux-arch, David S. Miller, Anton Blanchard,
	Benjamin Herrenschmidt, Chen Liqin, Chris Metcalf, Chris Zankel,
	David Howells, Frederic Weisbecker, Geert Uytterhoeven,
	Guan Xuetao, Haavard Skinnemoen, Heiko Carstens, Hirokazu Takata,
	James Hogan, Jesper Nilsson, Linus Torvalds, Martin Schwidefsky,
	Mathieu Desnoyers, Michael Ellerman, Michael Neuling,
	Michal Simek, Mike Frysinger, Oleg Nesterov, Ralf Baechle,
	Richard Kuo, Russell King, Tony Luck, Victor Kaplansky,
	Vineet Gupta, Will Deacon, Yoshinori Sato, jejb, linux-alpha,
	linux-sh, linux-kernel

On Thu, Nov 07, 2013 at 05:23:44PM +0100, Peter Zijlstra wrote:
> A number of situations currently require the heavyweight smp_mb(),
> even though there is no need to order prior stores against later
> loads.  Many architectures have much cheaper ways to handle these
> situations, but the Linux kernel currently has no portable way
> to make use of them.
> 
> This commit therefore supplies smp_load_acquire() and
> smp_store_release() to remedy this situation.  The new
> smp_load_acquire() primitive orders the specified load against
> any subsequent reads or writes, while the new smp_store_release()
> primitive orders the specifed store against any prior reads or
> writes.  These primitives allow array-based circular FIFOs to be
> implemented without an smp_mb(), and also allow a theoretical
> hole in rcu_assign_pointer() to be closed at no additional
> expense on most architectures.
> 
> In addition, the RCU experience transitioning from explicit
> smp_read_barrier_depends() and smp_wmb() to rcu_dereference()
> and rcu_assign_pointer(), respectively resulted in substantial
> improvements in readability.  It therefore seems likely that
> replacing other explicit barriers with smp_load_acquire() and
> smp_store_release() will provide similar benefits.  It appears
> that roughly half of the explicit barriers in core kernel code
> might be so replaced.
> 
> [Changelog by PaulMck]

As noted a few times in another thread, powerpc's smp_store_release()
needs to use smp_mb() rather than __lwsync(), like this:

#define smp_store_release(p, v)						\
do {									\
	compiletime_assert_atomic_type(*p);				\
	smp_mb();							\
	ACCESS_ONCE(*p) = (v);						\
} while (0)

Would you like to make this change, or should I send another patch?

							Thanx, Paul

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-11-23  1:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20131107162341.305859004@infradead.org>
     [not found] ` <20131107164503.325138873@infradead.org>
2013-11-23  1:32   ` [PATCH 3/3] arch: Introduce smp_load_acquire(), smp_store_release() Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).