Re: [PATCH] mm: prevent mmap_cache race in find_vma()

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

 



On Wed, Apr 03, 2013 at 09:33:48AM -0700, Paul E. McKenney wrote:
> On Wed, Apr 03, 2013 at 06:45:51AM -0700, Ian Lance Taylor wrote:

[ . . . ]

> > If using a sufficiently recent version of GCC, you can get the
> > behaviour that I think you want by using
> >     __atomic_load(&x, __ATOMIC_RELAXED)
> 
> If this maps to the memory_order_relaxed token defined in earlier versions
> of the C11 standard, then this absolutely does -not-, repeat -not-, work
> for ACCESS_ONCE().  The relaxed load instead guarantees is that the load
> will be atomic with respect to other atomic stores to that same variable,
> in other words, it will prevent "load tearing" and "store tearing".  I
> also believe that it prevents reloading ...

In addition, even if the semantics of relaxed loads now guarantee against
load combining, note that ACCESS_ONCE() is also used to prevent combining
and splitting of stores, for example:

	ACCESS_ONCE(p) = give_me_a_pointer();

							Thanx, Paul

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]