KeyDB icon indicating copy to clipboard operation
KeyDB copied to clipboard

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

Open salvatoredipietro opened this issue 7 months ago • 2 comments

We would like to propose this optimization for ARM architecture that, at runtime, it switches to SB instruction if supported by the system. In general, ISB instruction has lower cost for the CPU than"YIELD" on ARM64. Moreover, 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 27 '25 20:05 salvatoredipietro

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

salvatoredipietro avatar Jun 12 '25 17:06 salvatoredipietro

any initial feedback?

salvatoredipietro avatar Jul 10 '25 09:07 salvatoredipietro