folly icon indicating copy to clipboard operation
folly copied to clipboard

asm_volatile_pause: use isb on aarch64

Open wash-amzn opened this issue 3 years ago • 1 comments

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)

wash-amzn avatar Dec 21 '22 21:12 wash-amzn

@Orvid has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Jan 03 '23 22:01 facebook-github-bot

@Orvid merged this pull request in facebook/folly@062c143072f25516e939762b549993f75dd9e767.

facebook-github-bot avatar Jan 24 '23 01:01 facebook-github-bot