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

Evgeny Astigeevich eastigeevich at openjdk.org
Wed Jun 25 13:56:09 UTC 2025


> 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

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25801/files
  - new: https://git.openjdk.org/jdk/pull/25801/files/9b02a59c..ab8c7e6f

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25801&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25801&range=02-03

  Stats: 7 lines in 1 file changed: 2 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/25801.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25801/head:pull/25801

PR: https://git.openjdk.org/jdk/pull/25801


More information about the hotspot-compiler-dev mailing list