RFR: 8359348: G1: Improve cpu usage measurements for heap sizing [v2]

Man Cao manc at openjdk.org
Wed Jul 23 07:18:58 UTC 2025


On Thu, 17 Jul 2025 12:36:39 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> src/hotspot/share/gc/g1/g1Analytics.cpp line 174:
>> 
>>> 172:   // caches, therefore underestimate the impact of the concurrent GC activity on mutator threads.
>>> 173:   uint num_cpus = (uint)os::active_processor_count();
>>> 174:   num_cpus = MIN2(num_cpus, MAX2(ConcGCThreads, ParallelGCThreads));
>> 
>> Why the use of `ParallelGCThreads`? I thought parallel-threads are used only for stw-work but the current context about concurrent-work.
>
> `G1ConcRefinementThreads` and `ConcGCThreads` are by default bounded by  ParallelGCThreads, but maybe we can use `G1ConcRefinementThreads` directly here.

+1 to not use `ParallelGCThreads`. I'd prefer using `ConcGCThreads` only.
`ConcGCThreads` is usually smaller than `ParallelGCThreads`, and concurrent refinement threads typically consume very little CPU compared to concurrent mark workers, and only a small subset of concurrent refinement threads are active. It seems better to ignore `G1ConcRefinementThreads`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26351#discussion_r2224621896


More information about the hotspot-gc-dev mailing list