RFR: 8359348: G1: Improve cpu usage measurements for heap sizing
Albert Mingkun Yang
ayang at openjdk.org
Thu Jul 17 10:08:48 UTC 2025
On Wed, 16 Jul 2025 13:55:32 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:
> Hi,
>
> Please review this patch which takes into account the impact of concurrent GC activity on mutator threads when computing the time spent on GC activity in a time interval. Previously, only the GC pause times were considered, and the overhead imposed by concurrent GC worker threads was not included.
>
> With this change, we now estimate the impact of concurrent GC by dividing `elapsed_gc_cpu_time` by the number of CPUs. This provides an approximation of the additional time attributable to GC activity, assuming a fair CPU resource sharing. Although this method does not account for contention on other shared resources (such as memory bandwidth or caches), it offers a reasonable estimate for most scenarios.
>
> Testing: Tier 1
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26351#discussion_r2212920774
More information about the hotspot-gc-dev
mailing list