RFR: 8356880: ZGC: Backoff in ZLiveMap::reset spin-loop

Joel Sikström jsikstro at openjdk.org
Tue Jun 3 11:45:06 UTC 2025


On Mon, 2 Jun 2025 09:39:15 GMT, Joel Sikström <jsikstro at openjdk.org> wrote:

> 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.
> 
> * Oracle's tier 1-4

Thank you for the reviews!

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

PR Comment: https://git.openjdk.org/jdk/pull/25580#issuecomment-2934838795


More information about the hotspot-gc-dev mailing list