]> git.ipfire.org Git - thirdparty/bind9.git/commit
Improve the spinloop pause / yield hint
authorTony Finch <dot@dotat.at>
Wed, 24 Mar 2021 16:52:56 +0000 (17:52 +0100)
committerTony Finch <dot@dotat.at>
Tue, 14 Feb 2023 17:13:24 +0000 (17:13 +0000)
commit436b76bb17142fc9a9ad9bd420ad61b3e4685b2b
tree381e141c241608af6c144bc76cb82a6af30399dd
parentf32d334e419468e09b639a0a0736d125d09f0404
Improve the spinloop pause / yield hint

Unfortunately, C still lacks a standard function for pause (x86,
sparc) or yeild (arm) instructions, for use in spin lock or CAS loops.
BIND has its own based on vendor intrinsics or inline asm.

Previously, it was buried in the `isc_rwlock` implementation. This
commit renames `isc_rwlock_pause()` to `isc_pause()` and moves
it into <isc/pause.h>.

This commit also fixes the configure script so that it detects ARM
yield support on systems that identify as `aarch*` instead of `arm*`.

On 64-bit ARM systems we now use the ISB (instruction synchronization
barrier) instruction in preference to yield. The ISB instruction
pauses the CPU for longer, several nanoseconds, which is more like the
x86 pause instruction. There are more details in a Rust pull request,
which also refers to MySQL making the same change:
https://github.com/rust-lang/rust/pull/84725
CHANGES
configure.ac
lib/isc/Makefile.am
lib/isc/include/isc/pause.h [new file with mode: 0644]
lib/isc/rwlock.c