RFR: 8359435: AArch64: add support for SB instruction to MacroAssembler::spin_wait [v4]

Andrew Haley aph at openjdk.org
Thu Jun 26 08:16:28 UTC 2025


On Wed, 25 Jun 2025 13:56:09 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:

>> There is data SB-based spin pauses are less disruptive then ISB-based one on them, so performance is better:
>>   - https://github.com/mysql/mysql-server/pull/611
>>   - https://github.com/facebook/folly/pull/2390
>> 
>> There are discussions regarding using it for spin pauses:
>>   - https://github.com/gperftools/gperftools/pull/1594
>>   - https://github.com/haproxy/haproxy/pull/2974
>> 
>> Instruction support: https://developer.arm.com/documentation/109697/2025_03/Feature-descriptions/The-Armv8-5-architecture-extension
>> 
>> CPUs supporting it:
>> - Apple M2+
>> - Neoverse-N2
>> - Neoverse-V2
>> 
>> Tests:
>> - Gtests passed.
>> - `test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java` passed.
>> - `test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitNoneAArch64.java` passed.
>> 
>> Micro-benchmarks (Graviton 4, c8g.16xlarge (64 CPU), Neoverse-V2):
>> 
>> 
>> Benchmark                   Mode Cnt Score Error Units Diff
>> ThreadOnSpinWait.ISB     avgt     15    11.875 ± 0.129  ns/op
>> ThreadOnSpinWait.SB      avgt     15    6.930 ± 0.054  ns/op  -42%
>> 
>> Benchmark                            (maxNum)  (threadCount)  Mode  Cnt    Score    Error  Units  Diff
>> ThreadOnSpinWaitSharedCounter.ISB   1000000              4  avgt   15  49.874 ± 10.160  ms/op
>> ThreadOnSpinWaitSharedCounter.SB    1000000              4  avgt   15  26.948 ±  4.036  ms/op  -46%
>> ThreadOnSpinWaitSharedCounter.ISB   1000000              8  avgt   15  65.173 ±  7.228  ms/op
>> ThreadOnSpinWaitSharedCounter.SB    1000000              8  avgt   15  44.476 ±  1.292  ms/op  -31%
>> ThreadOnSpinWaitSharedCounter.ISB   1000000             16  avgt   15  177.805 ± 44.925  ms/op
>> ThreadOnSpinWaitSharedCounter.SB    1000000             16  avgt   15  67.267 ± 13.814  ms/op -62%
>> ThreadOnSpinWaitSharedCounter.ISB   1000000             32  avgt   15  265.149 ± 5.353  ms/op
>> ThreadOnSpinWaitSharedCounter.SB    1000000             32  avgt   15  42.297 ± 3.436  ms/op -84%
>> ThreadOnSpinWaitSharedCounter.ISB   1000000             48  avgt   15  125.231 ±  9.272  ms/op
>> ThreadOnSpinWaitSharedCounter.SB    1000000             48  avgt   15  83.504 ± 8.561  ms/op  -33%
>> ThreadOnSpinWaitSharedCounter.ISB   1000000             64  avgt   15  124.505 ±  7.543  ms/op
>> ThreadOnSpinWaitSharedCounter.SB    1000000             64  avgt   15  86.588 ± 9.519  ms/op -30%
>
> Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Restore check of non-zero exit value; make spinWaitInstCount always provided in test cmd options

Very sorry, my mistake. This is fine. :-)

-------------

Marked as reviewed by aph (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25801#pullrequestreview-2961173101


More information about the hotspot-compiler-dev mailing list