RFR: 8314551: More generic way to handshake GC threads with monitor deflation

Roman Kennke rkennke at openjdk.org
Thu Aug 17 22:04:47 UTC 2023


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.

Testing:
 - [ ] hotspot_gc
 - [ ] tier1

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

Commit messages:
 - 8314551: More generic way to handshake GC threads with monitor deflation

Changes: https://git.openjdk.org/jdk/pull/15336/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15336&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8314551
  Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/15336.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15336/head:pull/15336

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


More information about the hotspot-runtime-dev mailing list