JDK-8314551 : More generic way to handshake GC threads with monitor deflation
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 21,22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2023-08-17
  • Updated: 2023-10-02
  • Resolved: 2023-09-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 22
22 b16Fixed
Related Reports
Relates :  
Description
We currently handshake GC threads with monitor deflation by calling SuspendibleThreadSet::synchronize() and SuspendibleThreadSet::desynchronize(). This is somewhat problematic though, because GCs may use other mechanisms to sync their GC threads. In particular, ZGC uses ZRelocateQueue to do that.

Luckily, CollectedHeap comes with interfaces for exactly this purpose: CollectedHeap::safepoint_synchronize_begin() and CollectedHeap::safepoint_synchronize_end(). Those methods are implemented by ZGC to do the correct synchronization with ZRelocateQueue. All GCs which need that sort of synchronization are overriding these methods and delegate to STS methods, so we can replace the STS calls with the CollectedHeap calls.
Comments
[jdk21u-fix-request] Approval Request from Aleksey Shipilëv Clean backport to to complement [JDK-8307236](https://bugs.openjdk.org/browse/JDK-8307236) that is already in JDK 21. There is no bugtail in JDK 22 so far
02-10-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u/pull/222 Date: 2023-10-02 12:34:54 +0000
02-10-2023

Changeset: 31c4e03d Author: Roman Kennke <rkennke@openjdk.org> Date: 2023-09-15 09:48:58 +0000 URL: https://git.openjdk.org/jdk/commit/31c4e03d5d4682a10825bd7cf2d37971e686b31e
15-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15336 Date: 2023-08-17 21:58:42 +0000
17-08-2023