[crac] RFR: Wait until G1 GC has finished before creating a snapshot. [v6]

Anton Kozlov akozlov at openjdk.org
Thu Aug 3 14:50:57 UTC 2023

On Thu, 3 Aug 2023 12:26:02 GMT, Jan Kratochvil <jkratochvil at openjdk.org> wrote:

> You suggest during CRaC snapshot the whole VM is already frozen so we do not need any synchronization? OK, if it is so I can just call `uncommit_regions`.

Please check if that is safe. I propose to call g1h->uncommit_regions() from the VM operation. But I'm not a G1/GC expert. AFAICS G1ServiceThread (G1ServiceThread::run_service) calls Task's execute() without sync, so we need at most synchornization implied by G1UncommitRegionTask::execute [1]. I missed this in the first reading: what does SuspendibleThreadSetJoiner do? That can be unnecessary if the uncommit is performed from the VM op. I don't see any synchronization beyond that (excluding some inside of uncommit_regions and its callees). 

It may be worth to discuss this on hotspot-gc-dev mail list [2].

[1] https://github.com/openjdk/crac/blob/crac/src/hotspot/share/gc/g1/g1UncommitRegionTask.cpp#L105
[2] https://mail.openjdk.org/pipermail/hotspot-gc-dev/


PR Review Comment: https://git.openjdk.org/crac/pull/93#discussion_r1283318664

More information about the crac-dev mailing list