RFR: 8373695: G1: Using a value near integer max for ActiveProcessorCount causes fatal crash [v3]

Thomas Schatzl tschatzl at openjdk.org
Wed Jan 7 08:43:54 UTC 2026


On Mon, 5 Jan 2026 09:25:18 GMT, Jonas Norlinder <jnorlinder at openjdk.org> wrote:

>> G1ConcRefinementThreads default value depends on ParallelGCThreads which in turn may depend on ActiveProcessorCount. These have different ranges that are valid. Patch will ensure argument setup code never try to assign a value larger than what G1ConcRefinementThreads expects.
>
> Jonas Norlinder has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Minimize changeset

Changes requested by tschatzl (Reviewer).

src/hotspot/share/gc/g1/g1Arguments.cpp line 194:

> 192:   } else if (FLAG_IS_DEFAULT(G1ConcRefinementThreads)) {
> 193:     constexpr uint MaxG1ConcRefinementThreads = (max_jint - 1) / wordSize; // Derived from flag declaration
> 194:     FLAG_SET_ERGO(G1ConcRefinementThreads, MIN2(ParallelGCThreads, MaxG1ConcRefinementThreads));

Maybe use the flags API to programmatically get the maximum instead of hardcoding the value, something like this:


    const JVMTypedFlagLimit<uint>* conc_refinement_threads_limits = JVMFlagLimit::get_range_at(FLAG_MEMBER_ENUM(G1ConcRefinementThreads))->cast<uint>();
    FLAG_SET_ERGO(G1ConcRefinementThreads, MIN2(ParallelGCThreads, conc_refinement_threads_limits->max()));

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

PR Review: https://git.openjdk.org/jdk/pull/28831#pullrequestreview-3633865050
PR Review Comment: https://git.openjdk.org/jdk/pull/28831#discussion_r2667540751


More information about the hotspot-gc-dev mailing list