Integrated: 8356000: C1/C2-only modes use 2 compiler threads on low CPU count machines

Aleksey Shipilev shade at openjdk.org
Wed Jun 4 14:24:14 UTC 2025


On Wed, 30 Apr 2025 19:00:23 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> There is an unfortunate limitation with default tiered policy that we would have at least 2 threads on 1 CPU machine: 1 thread for C1, and 1 thread for C2.
> 
> But if we select C1-only or C2-only modes, we _also_ get 2 compiler threads, for which we have no good reason. These threads would just step on each other toes. The fix changes the behavior for 1..3 CPU hosts in C1/C2-only configurations, by using 1 thread instead of 2 threads. The change for 1 CPU config is what we really need. The change in 2..3 CPU configs is an additional effect, but I think it is still good not to use 100%/66% of the CPUs in those configurations as well.
> 
> 
> $ for I in `seq 1 8`; do build/linux-x86_64-server-release/images/jdk/bin/java \
>   -XX:-TieredCompilation -XX:ActiveProcessorCount=${I} \
>   -XX:+PrintFlagsFinal 2>&1 | grep "CICompilerCount "; done
> 
> # Before
>      intx CICompilerCount                          = 2
>      intx CICompilerCount                          = 2
>      intx CICompilerCount                          = 2
>      intx CICompilerCount                          = 3
>      intx CICompilerCount                          = 3
>      intx CICompilerCount                          = 3
>      intx CICompilerCount                          = 3
>      intx CICompilerCount                          = 4
> 
> # After
>      intx CICompilerCount                          = 1
>      intx CICompilerCount                          = 1
>      intx CICompilerCount                          = 1
>      intx CICompilerCount                          = 3
>      intx CICompilerCount                          = 3
>      intx CICompilerCount                          = 3
>      intx CICompilerCount                          = 3
>      intx CICompilerCount                          = 4
> 
> 
> It is a minor bug in `CompilationPolicy::initialize`, but it gets in the way studying Leyden in tight CPU scenarios. 
> 
> Additional testing:
>  - [x] New regression test passes with the fix, fails without it
>  - [x] GHA
>  - [x] Linux AArch64 server fastdebug, `all`

This pull request has now been integrated.

Changeset: 4e314cb9
Author:    Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/4e314cb9e025672b2f7b68cc021fa516ee219ad8
Stats:     185 lines in 2 files changed: 182 ins; 0 del; 3 mod

8356000: C1/C2-only modes use 2 compiler threads on low CPU count machines

Reviewed-by: kvn, dfenacci, galder

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

PR: https://git.openjdk.org/jdk/pull/24972


More information about the hotspot-compiler-dev mailing list