]> git.proxmox.com Git - ovs.git/commit
lib/cmap: Use non-atomic access to hash.
authorJarno Rajahalme <jrajahalme@nicira.com>
Wed, 24 Sep 2014 17:39:20 +0000 (10:39 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Mon, 6 Oct 2014 22:33:45 +0000 (15:33 -0700)
commit5c416811ee851961052feb5330c6fd2227b314a8
tree6d840318e1dd6bea19d2f9efdac79e60686ef01d
parent6b3b75b7b2dd41a23c3ca3311a6b0f8a7d84f20b
lib/cmap: Use non-atomic access to hash.

We use the 'counter' as a "lock" providing acquire-release
semantics.  Therefore we can use normal, non-atomic access to the
memory accesses between the atomic accesses to 'counter'.  The
cmap_node.next needs to be RCU, so that can not be changed.

For the writer this is straightforward, as we first acquire-read the
counter and after all the changes we release-store the counter.  For
the reader this is a bit more complex, as we need to make sure the
last counter read is not reordered with the preceding read operations
on the bucket contents.

Also rearrange code to benefit from the fact that hash values are
unique in any bucket.

This patch seems to make cmap_insert() a bit faster.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/cmap.c