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

Joel Sikström jsikstro at openjdk.org
Tue Jun 3 11:45:07 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

This pull request has now been integrated.

Changeset: 78a392aa
Author:    Joel Sikström <jsikstro at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/78a392aa3b0cda52cfacfa15250fa61010519424
Stats:     33 lines in 1 file changed: 11 ins; 0 del; 22 mod

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

Reviewed-by: stefank, eosterlund, aboldtch

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

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


More information about the hotspot-gc-dev mailing list