RFR: 8356880: Backoff in ZLiveMap::reset spin-loop
Joel Sikström
jsikstro at openjdk.org
Mon Jun 2 09:43:03 UTC 2025
Hello,
This RFE addresses contention in ZLiveMap::reset caused by [JDK-8351167](https://bugs.openjdk.org/browse/JDK-8351167). The contention is noticeable on (Linux) aarch64, where the Atomic::load_acquire in the spin-loop is slower than on other platforms.
To reduce spinning, and in turn the number of calls to Atomic::load_acquire, I suggest we introduce a backoff via a SpinYield to allow some time for the thread responsible for resetting to finish. The SpinYield always sleeps for 1µs, which should be enough time for an average malloc call to finish. The requirement for low latency is not as strict when it's only GC threads waiting for each other, and the livemap is only allocated once per page, so always sleeping should be reasonable.
The regression caused by [JDK-8351167](https://bugs.openjdk.org/browse/JDK-8351167) was observed on SPECjvm2008-LU.small on linux-aarch64. The performance is noticeably better on linux-aarch64 when applying the patch to jdk-25+15 (which included [JDK-8351167](https://bugs.openjdk.org/browse/JDK-8351167)). However, the performance is neutral when applying the patch to mainline now. With this in mind I think we still want to address the contention this way.
* Currently running through tier 1-4
-------------
Commit messages:
- 8356880: Backoff in ZLiveMap::reset spin-loop
Changes: https://git.openjdk.org/jdk/pull/25580/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25580&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8356880
Stats: 33 lines in 1 file changed: 11 ins; 0 del; 22 mod
Patch: https://git.openjdk.org/jdk/pull/25580.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25580/head:pull/25580
PR: https://git.openjdk.org/jdk/pull/25580
More information about the hotspot-gc-dev
mailing list