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

Erik Österlund eosterlund at openjdk.org
Mon Dec 1 16:04:34 UTC 2025


On Mon, 1 Dec 2025 10:52:57 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

> 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
>   * Stress-tested with reproducer `while java -XX:-UseCompressedOops -XX:+UseParallelGC -XX:InitialHeapSize=1m -Xmx1002M -version; do date;`

Looks good.

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

Marked as reviewed by eosterlund (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28574#pullrequestreview-3525786577


More information about the hotspot-gc-dev mailing list