forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Acked-by: Ben Pfaff <[email protected]>
- Loading branch information
Jarno Rajahalme
committed
Oct 6, 2014
1 parent
6b3b75b
commit 5c41681
Showing
1 changed file
with
22 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters