summaryrefslogtreecommitdiff
path: root/lib/ovs-atomic-x86_64.h
Commit message (Collapse)AuthorAgeFilesLines
* treewide: Remove uses of ATOMIC_VAR_INIT.Fangrui Song2023-03-061-1/+0
| | | | | | | | | | ATOMIC_VAR_INIT has a trivial definition `#define ATOMIC_VAR_INIT(value) (value)`, is deprecated in C17/C++20, and will be removed in newer standards in newer GCC/Clang (e.g. https://reviews.llvm.org/D144196). Signed-off-by: Fangrui Song <maskray@google.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* ovs-atomic: Expose atomic exchange operation.Gaetan Rivet2022-01-181-0/+5
| | | | | | | | | | | The atomic exchange operation is a useful primitive that should be available as well. Most compilers already expose or offer a way to use it, but a single symbol needs to be defined. Signed-off-by: Gaetan Rivet <grive@u256.net> Reviewed-by: Eli Britstein <elibr@nvidia.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
* lib/ovs-atomic: Add missing macro argument parentheses.Jarno Rajahalme2014-08-291-7/+7
| | | | | | | | | | Otherwise the dereference operator could target a portion of a ternary expression, for example. Also minor style fixes. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib/ovs-atomic: Native support for x86_64 with GCC.Jarno Rajahalme2014-08-051-0/+351
Some supported XenServer build environments lack compiler support for atomic operations. This patch provides native support for x86_64 on GCC, which covers possible future 64-bit builds on XenServer. Since this implementation is faster than the existing support prior to GCC 4.7, especially for cmap inserts, we use this with GCC < 4.7 on x86_64. Example numbers with "tests/test-cmap benchmark 2000000 8 0.1" on quad-core hyperthreaded laptop, built with GCC 4.6 -O2: Using ovs-atomic-pthreads on x86_64: Benchmarking with n=2000000, 8 threads, 0.10% mutations: cmap insert: 4725 ms cmap iterate: 329 ms cmap search: 5945 ms cmap destroy: 911 ms Using ovs-atomic-gcc4+ on x86_64: Benchmarking with n=2000000, 8 threads, 0.10% mutations: cmap insert: 845 ms cmap iterate: 58 ms cmap search: 308 ms cmap destroy: 295 ms With the native support provided by this patch: Benchmarking with n=2000000, 8 threads, 0.10% mutations: cmap insert: 530 ms cmap iterate: 59 ms cmap search: 305 ms cmap destroy: 232 ms Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>