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

Thomas Schatzl tschatzl at openjdk.java.net
Tue Aug 3 08:33:43 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

Marked as reviewed by tschatzl (Reviewer).

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

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



More information about the hotspot-gc-dev mailing list