folly
folly copied to clipboard
asm_volatile_pause: use isb on aarch64
Summary:
On aarch64, we've found isb to be a better analogue to the x86 pause instruction. The SpinLock.TryLock test/microbenchmark shows a one to two order-of-magnitude reduction in runtime (its runtime is highly variable with and without this change due to its very race-y nature).
Testing:
I ran this on aarch64 with Ubuntu 22. Sample runtimes of SpinLock.TryLock before:
[ OK ] SpinLock.TryLock (50903 ms)
[ OK ] SpinLock.TryLock (32773 ms)
[ OK ] SpinLock.TryLock (70178 ms)
and after:
[ OK ] SpinLock.TryLock (728 ms)
[ OK ] SpinLock.TryLock (2003 ms)
[ OK ] SpinLock.TryLock (2 ms)
@Orvid has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@Orvid merged this pull request in facebook/folly@062c143072f25516e939762b549993f75dd9e767.