RFR: 8372645: ParallelGC: Remove race between allocation and expansion before is_init_completed

Axel Boldt-Christmas aboldtch at openjdk.org
Mon Dec 1 11:00:33 UTC 2025


JDK-8370943 added the ability to expand the heap for Serial and Parallel without having to GC during early startup (before `is_init_completed`). The expansion code was written with the assumption that it is performed in a safepoint. 

We have currently observed one crash related to the fact that top is updated before we setup the card table. 

I propose that we create a critical section for the early expansion and any early allocation. 

We might want to relax this critical section in the future, after we have fixed the expansion code and allocation interactions. But for now it seems safer to simply use a mutex.

_We also looked at using a RW style lock, but deemed it a bit unnecessary (https://github.com/openjdk/jdk/compare/master...xmas92:jdk:pre-init-expansion-rw-lock). Any potential performance gain may be better achieved by simply resolving the synchronisation issues with expansion._ 

* Testing
  * GHA
  * Tier 1-3 on Oracle supported platforms

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

Commit messages:
 - 8372645: ParallelGC: Remove race between allocation and expansion before is_init_completed

Changes: https://git.openjdk.org/jdk/pull/28574/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28574&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8372645
  Stats: 16 lines in 1 file changed: 9 ins; 0 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/28574.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28574/head:pull/28574

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


More information about the hotspot-gc-dev mailing list