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

Kim Barrett kbarrett at openjdk.java.net
Mon Jul 26 18:14:01 UTC 2021


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

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

Commit messages:
 - eliminate races in periodic gc requests

Changes: https://git.openjdk.java.net/jdk/pull/4905/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4905&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8271217
  Stats: 159 lines in 8 files changed: 126 ins; 13 del; 20 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4905.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4905/head:pull/4905

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


More information about the hotspot-gc-dev mailing list