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

Jan Kratochvil jkratochvil at openjdk.org
Wed Jul 26 16:52:55 UTC 2023


On Tue, 25 Jul 2023 11:42:40 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

>> Jan Kratochvil has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add a generic virtual method wait_for_collection_finish().
>>    - based on a review by Radim Vansa.
>>   Assert calling thread state for wait_for_collection_finish().
>>    - based on a review by Radim Vansa.
>
> src/hotspot/share/gc/g1/g1UncommitRegionTask.cpp line 144:
> 
>> 142: }
>> 143: 
>> 144: void G1UncommitRegionTask::wait_if_active() {
> 
> I guess this gets thread-safe because `_instance` is set in VM thread, and we're calling it from another VM operation. However a comment, and preferably an assertion on which thread is executing this would be helpful in the future.

I have added there some assertions. Not sure they should stay this way, do you have more insight about it?

> src/hotspot/share/runtime/crac.cpp line 409:
> 
>> 407:   Universe::heap()->collect(GCCause::_full_gc_alot);
>> 408:   Universe::heap()->set_cleanup_unused(false);
>> 409:   G1UncommitRegionTask::wait_if_active();
> 
> Should we create a generic virtual method on heap (noop by default) to make this part of code GC-agnostic?

Yes, that makes sense, done, thanks.

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

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


More information about the crac-dev mailing list