diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2016-09-30 22:31:00 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-10-04 10:00:26 +0200 |
commit | a890643958f03aaa344290700093b280cb606c28 (patch) | |
tree | 3c49b66767086eb01021e88e8c4611dabdc8361b /util/rfifolock.c | |
parent | 027d9a7d2911e993cdcbd21c7c35d1dd058f05bb (diff) | |
download | qemu-a890643958f03aaa344290700093b280cb606c28.zip qemu-a890643958f03aaa344290700093b280cb606c28.tar.gz qemu-a890643958f03aaa344290700093b280cb606c28.tar.bz2 |
util/qht: atomically set b->hashes
ThreadSanitizer detects a possible race between reading/writing the
hashes. The ordering semantics are already documented for QHT however
for true C11 compliance we should use relaxed atomic primitives for
accesses that are done across threads. On x86 this slightly changes to
the code to not do a load/compare in a single instruction leading to a
slight performance degradation.
Running 'taskset -c 0 tests/qht-bench -n 1 -d 10' (i.e. all lookups) 10
times, we get:
before the patch:
$ ./mean.pl 34.04 34.24 34.38 34.25 34.18 34.51 34.46 34.44 34.29 34.08
34.287 +- 0.160072900059109
after:
$ ./mean.pl 33.94 34.00 33.52 33.46 33.55 33.71 34.27 34.06 34.28 34.58
33.937 +- 0.374731014640279
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Emilio G. Cota <cota@braap.org>
Message-Id: <20160930213106.20186-10-alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/rfifolock.c')
0 files changed, 0 insertions, 0 deletions