RFR: 8271217: Fix race between G1PeriodicGCTask checks and GC request

Kim Barrett kbarrett at openjdk.java.net
Wed Aug 4 14:51:29 UTC 2021


On Mon, 2 Aug 2021 07:19:12 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> Please review this change to remove a race involving G1PeriodicGCTask.  The
>> task performs various checks to determine whether a periodic GC should be
>> performed.  If they pass, then it requests the GC by calling try_collect.
>> The problem is that an unrelated GC could occur after the task's checks but
>> before its request is processed.  In that case we don't want to do the
>> periodic GC after all, but there's nothing to prevent it.
>> 
>> This change lets the task capture the various GC counters as part of its
>> checking, and pass them to try_collect for use in detecting an intervening
>> GC.
>> 
>> Testing:
>> mach5 tier1
>
> Lgtm!

Thanks @walulyai , @tschatzl , and @lkorinth for reviews.

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

PR: https://git.openjdk.java.net/jdk/pull/4905



More information about the hotspot-gc-dev mailing list