From: Ondřej Surý Date: Wed, 6 Nov 2019 09:49:28 +0000 (+0100) Subject: Avoid an extra atomic_load() call X-Git-Tag: v9.15.6~31^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4df5a6ecb27c0db1f7f00eeb0ab913a16100d26;p=thirdparty%2Fbind9.git Avoid an extra atomic_load() call --- diff --git a/lib/isc/stats.c b/lib/isc/stats.c index 44cc2d4e1bc..4f7f283b2fc 100644 --- a/lib/isc/stats.c +++ b/lib/isc/stats.c @@ -157,15 +157,12 @@ void isc_stats_update_if_greater(isc_stats_t *stats, REQUIRE(ISC_STATS_VALID(stats)); REQUIRE(counter < stats->ncounters); - isc_statscounter_t curr_value; - + isc_statscounter_t curr_value = + atomic_load_relaxed(&stats->counters[counter]); do { - curr_value = atomic_load_explicit(&stats->counters[counter], - memory_order_relaxed); if (curr_value >= value) { break; } - } while (!atomic_compare_exchange_strong(&stats->counters[counter], &curr_value, value));