Re: [PATCH RFC tip/core/rcu 12/15] lib/assoc_array: Remove smp_read_barrier_depends()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 11, 2017 at 05:07:05PM +0100, David Howells wrote:
> Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx> wrote:
> 
> > It does not.  In most cases, the barriered version would be
> > smp_store_release().
> 
> Ummm... Is that good enough?  Is:
> 
> 	WRITE_ONCE(x, 1);
> 	WRITE_ONCE(x, 2);
> 
> equivalent to:
> 
> 	smp_store_release(x, 1);
> 	smp_store_release(x, 2);
> 
> if CONFIG_SMP=n?

Almost; it ends up being:

	barrier();
	WRITE_ONCE(x, 1);
	barrier();
	WRITE_ONCE(x, 2);

> (Consider what happens if an interrupt messes with x).
> 
> If it is good enough, should we be using smp_load_acquire() rather than
> READ_ONCE()?

No, smp_load_acquire() is strictly stronger (and far more expensive on
!Alpha).

Dependent loads do not require barriers (except Alpha, and we want to
kill that special case).



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux