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

Johan Sjölen jsjolen at openjdk.org
Mon Sep 4 10:24:42 UTC 2023


On Thu, 17 Aug 2023 21:58:42 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> 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:
>  - [x] hotspot_gc
>  - [x] tier1

Hi Roman,

This change looks good to me. I've asked for input from GC in case there are any considerations that are easily missed when only reading the surrounding code.

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

Marked as reviewed by jsjolen (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15336#pullrequestreview-1609232061


More information about the hotspot-runtime-dev mailing list