RFR: 8375359: Improve GC serviceability init staging [v2]
Aleksey Shipilev
shade at openjdk.org
Wed Feb 18 15:16:46 UTC 2026
> As per docs, `CollectedHeap::post_initialize` is for doing inits that should be done before general allocations are accepted. Currently, serviceability layer initialized there via the call to `CollectedHeap::initialize_serviceability`. This bug shows that after `CollectedHeap::post_initialize` returns, the rest of the serviceability layer had not been fully initialized yet. But GC code might assume general allocation path works at that point! So if that allocation path reports anything to the serviceability layer, it could encounter not yet fully initialized serviceability support and fail.
>
> This readily manifests in improved Epsilon stress test. Improved test fails pretty consistently on my machines, and serves as a good regression test.
>
> So the fix is to peel off serviceability initialization from post-init stage, and do it separately, before going (and finishing) `post_initialize`. Conveniently, we are nearly there, and "just" need to touch up a few things in `universe_post_init()`.
>
> Additional testing:
> - [x] Linux x86_64 server fastdebug, `gc/epsilon/TestInitAllocs.java`, 10x
> - [x] Linux x86_64 server fastdebug, `hotspot_gc`
Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Even cleaner init sequence
- Merge branch 'master' into JDK-8375359-epsilon-load-race
- Fix
- Stress test
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/29254/files
- new: https://git.openjdk.org/jdk/pull/29254/files/9418a170..e7ba9978
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=29254&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=29254&range=00-01
Stats: 119447 lines in 2314 files changed: 59224 ins; 26975 del; 33248 mod
Patch: https://git.openjdk.org/jdk/pull/29254.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29254/head:pull/29254
PR: https://git.openjdk.org/jdk/pull/29254
More information about the hotspot-dev
mailing list