2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 05:28:00 +00:00

Skip the no-op code in adjustsrtt()

If factor == DNS_ADB_RTTADJAGE and addr->entry->lastage == now we would
load value into new_srtt and then immediatelly store it back which
triggers the synchronization between threads using .srtt values.
This commit is contained in:
Ondřej Surý 2023-10-12 09:17:40 +02:00
parent cb0db600e7
commit 0635bd01cb
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41

View File

@ -3057,18 +3057,17 @@ adjustsrtt(dns_adbaddrinfo_t *addr, unsigned int rtt, unsigned int factor,
new_srtt -= addr->entry->srtt;
new_srtt >>= 9;
atomic_store(&addr->entry->lastage, now);
} else {
new_srtt = atomic_load(&addr->entry->srtt)
atomic_store(&addr->entry->srtt, new_srtt);
addr->srtt = new_srtt;
}
} else {
new_srtt = ((uint64_t)atomic_load(&addr->entry->srtt) / 10 *
factor) +
((uint64_t)rtt / 10 * (10 - factor));
atomic_store(&addr->entry->srtt, new_srtt);
addr->srtt = new_srtt;
}
atomic_store(&addr->entry->srtt, new_srtt);
addr->srtt = new_srtt;
(void)atomic_compare_exchange_strong(&addr->entry->expires,
&(isc_stdtime_t){ 0 },
now + ADB_ENTRY_WINDOW);