[ovs-dev] [PATCH v3 5/8] lib/ovs-atomic-gcc4+: Use 'volatile' to enforce memory access.
blp at nicira.com
Tue Aug 5 18:13:38 UTC 2014
On Thu, Jul 31, 2014 at 03:21:51PM -0700, Jarno Rajahalme wrote:
> Use 'volatile' to enforce a new memory access on each lockless atomic
> store and read. Without this a loop consisting of an atomic_read with
> memory_order_relaxed would be simply optimized away. Also, using
> volatile is cheaper than adding a full compiler barrier (also) in that
> This use of a volatile cast mirrors the Linux kernel ACCESS_ONCE macro.
> Without this change the more rigorous atomic test cases introduced in
> a following patch will hang due to the atomic accesses being optimized
> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
Acked-by: Ben Pfaff <blp at nicira.com>
More information about the dev