RFR: 8278241: Implement JVM SpinPause on linux-aarch64 [v2]

Evgeny Astigeevich duke at openjdk.java.net
Mon Dec 13 15:56:02 UTC 2021


> This JVM SpinPause can use different implementations of spin pauses. It uses `SpinWait` description which is defined with `OnSpinWaitInst`/`OnSpinWaitInstCount` options.  The `SpinWait` provides an instruction runner together with the description of the instruction and the instruction count. It can be used at places where generation of spin pauses is not possible, like in runtime SpinPause function.
> 
> The `SpinWait` description is also used for the `_onSpinWait()` intrinsic. We don't have use cases when we need different implementations for the `_onSpinWait()` intrinsic and JVM SpinPause. However JVM SpinPause might need less instructions than the intrinsic. To support such cases the instruction runner interface supports the `count` parameter.
> 
> Testing results for fastdebug and release builds:
> - `gtest`: Passed
> - `tier1`...`tier4`: Passed
> - `hotspot/jtreg/runtime/Thread/TestSpinPause.java`: Passed
> 
> JVM SpinPause is used for the synchronised statements and can benchmarked with `org.openjdk.bench.vm.lang.LockUnlock.testContendedLock`.
> 
> Benchmarking results (number of samples per an experiment: 150) for Graviton2 (Neoverse N1), 1 ISB instruction:
> 
> 
> 
> +-----------+-------------------+------------+-----------+-----------+----------+---------+
> | CPU cores | Contended threads | Base ns/op |   Error   |    New    |  Error   |  Diff   |
> +-----------+-------------------+------------+-----------+-----------+----------+---------+
> |         8 |                64 |  10007.213 | ±910.911  |  8527.346 | ±377.242 | -14.79% |
> |        16 |                64 |  10274.935 | ±880.568  |  8310.433 | ±326.845 | -19.12% |
> |        32 |                64 |  12231.947 | ±1525.364 |  9205.941 | ±394.409 | -24.74% |
> |        64 |                64 |    9929.49 | ±586.074  | 10488.695 | ±570.458 | 5.63%   |
> |        64 |                32 |   5605.119 | ±629.340  |  5023.882 | ±230.639 | -10.37% |
> |        64 |                16 |   2817.346 | ±263.696  |  2367.528 | ±94.158  | -15.97% |
> |        64 |                 2 |    870.389 | ±530.579  |   464.395 | ±126.260 | -46.65% |
> +-----------+-------------------+------------+-----------+-----------+----------+---------+

Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision:

  Reimplement JVM SpinPause with using stub code

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/6803/files
  - new: https://git.openjdk.java.net/jdk/pull/6803/files/901b5908..7c9877e5

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=6803&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=6803&range=00-01

  Stats: 76 lines in 8 files changed: 27 ins; 40 del; 9 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6803.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6803/head:pull/6803

PR: https://git.openjdk.java.net/jdk/pull/6803


More information about the hotspot-dev mailing list