RFR: 8271217: Fix race between G1PeriodicGCTask checks and GC request
Leo Korinth
lkorinth at openjdk.java.net
Wed Aug 4 09:11:30 UTC 2021
On Mon, 26 Jul 2021 18:05:10 GMT, Kim Barrett <kbarrett 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
Looks good to me.
If you like, you could initialize the values of the counters in the default constructor (to zero for example).
-------------
Marked as reviewed by lkorinth (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/4905
More information about the hotspot-gc-dev
mailing list