RFR: 8356667: GenShen: Eliminate races with ShenandoahFreeSet::available()

Kelvin Nilsen kdnilsen at openjdk.org
Mon May 12 22:43:26 UTC 2025


Two changes:

1. Compute the difference between capacity and used while holding the heap lock (so that these two values do not change in incompatible ways while the difference is being computed)
2. Return a "harmless" Sentinel value in case available() is consulted while we are in the process of rebuilding the freeset.  The SIZE_MAX value is considered harmless in that it will not cause immediate trigger of a new GC.  In typical usage, the control or regulator thread will check available() again in another millisecond, at which time a more accurate accounting of available will be provided (if the freeset reconstruction has been completed).

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

Commit messages:
 - Fix white apce
 - available() returns Sentinel if under construction
 - Log full gc region transfers outside heaplock
 - Make ShenFreeSet::available() race free
 - Merge branch 'openjdk:master' into master
 - Merge branch 'openjdk:master' into master
 - Merge branch 'openjdk:master' into master
 - Merge branch 'openjdk:master' into master
 - Merge branch 'openjdk:master' into master
 - Merge branch 'openjdk:master' into master
 - ... and 29 more: https://git.openjdk.org/jdk/compare/92730945...6353f1f7

Changes: https://git.openjdk.org/jdk/pull/25165/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25165&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8356667
  Stats: 95 lines in 10 files changed: 72 ins; 9 del; 14 mod
  Patch: https://git.openjdk.org/jdk/pull/25165.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25165/head:pull/25165

PR: https://git.openjdk.org/jdk/pull/25165


More information about the hotspot-gc-dev mailing list