Adding 'sb' instruction to spin_delay() for ARM v8.5 onward
We would like to propose this optimization for ARM architecture that, at runtime, it switches to SB instruction if supported by the system. SB (Speculation Barrier) is a modern barrier which is available from armv8.5a. It achieves the same result as issuing ISB, but instead of flushing the CPU it does so by serializing older instructions to be non-speculative before it completes. This is less disruptive than an "isb" to high performance CPUs.
We already saw positive improvements on MySQL server (https://github.com/mysql/mysql-server/pull/611) and Folly (https://github.com/facebook/folly/pull/2390).
Can anyone take a look to this and provide some initial feedback, please?
Thank you for bringing this to our attention. The code appears reasonable but we will first explore options for our code base which avoids the branching.
thanks @xorphox. Do you have any update about this?