[ovs-dev] [PATCH 00/18] Use relaxed atomic operations when possible.

Jarno Rajahalme jrajahalme at nicira.com
Fri Aug 22 21:09:18 UTC 2014

On Aug 22, 2014, at 1:58 PM, Jarno Rajahalme <jrajahalme at nicira.com> wrote:

> The default memory order for atomic operations is
> memory_order_seq_cst, which synchronizes the whole system, i.e., locks
> the memory bus, which is very expensive.  memory_order_relaxed, on the
> other hand, does not impose any kind of memory barrier (not even a
> compiler barrier), which allows for better code optimization.  The
> cost of atomic access itself remains: an atomic access always causes a
> memory system access (which usually is cached).

Should have noted that atomic read-modify-write operations (add, sub, etc.) lock the bus anyway, but atomic stores and loads do not if the memory order is “relaxed”.


More information about the dev mailing list