aerospike-common icon indicating copy to clipboard operation
aerospike-common copied to clipboard

Adding 'sb' instruction to spin_delay() for ARM v8.5 onward

Open salvatoredipietro opened this issue 6 months ago • 3 comments

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).

salvatoredipietro avatar May 20 '25 21:05 salvatoredipietro

Can anyone take a look to this and provide some initial feedback, please?

salvatoredipietro avatar Jun 12 '25 17:06 salvatoredipietro

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.

xorphox avatar Jun 12 '25 18:06 xorphox

thanks @xorphox. Do you have any update about this?

salvatoredipietro avatar Jul 10 '25 09:07 salvatoredipietro