JDK-8356000 : C1/C2-only modes use 2 compiler threads on low CPU count machines
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8,11,17,21,24,25
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-04-30
  • Updated: 2025-06-11
  • Resolved: 2025-06-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 b26Fixed
Related Reports
Relates :  
Description
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.

$ build/linux-x86_64-server-release/images/jdk/bin/java -XX:-TieredCompilation -XX:ActiveProcessorCount=1 -XX:+PrintFlagsFinal 2>&1 | grep CICompilerCount
     intx CICompilerCount                          = 2                                         {product} {ergonomic}
     bool CICompilerCountPerCPU                    = true                                      {product} {default}

$ build/linux-x86_64-server-release/images/jdk/bin/java -XX:TieredStopAtLevel=1 -XX:ActiveProcessorCount=1 -XX:+PrintFlagsFinal 2>&1 | grep CICompilerCount
     intx CICompilerCount                          = 2                                         {product} {ergonomic}
     bool CICompilerCountPerCPU                    = true                                      {product} {default}

It is a minor bug in `CompilationPolicy::initialize`, but it gets in the way studying Leyden in tight CPU scenarios.
Comments
Changeset: 4e314cb9 Branch: master Author: Aleksey Shipilev <shade@openjdk.org> Date: 2025-06-04 14:21:34 +0000 URL: https://git.openjdk.org/jdk/commit/4e314cb9e025672b2f7b68cc021fa516ee219ad8
04-06-2025

Right, I just wondered if the fix might also affect JDK-8354727 but it doesn't seem so. Thanks!
07-05-2025

No, JDK-8354727 is issue about scaling compiler threads count for small CodeCache. This one is about small CPU count (1).
05-05-2025

Is this related to JDK-8354727?
05-05-2025

ILW = Unnecessarily creating too many compiler threads in "C1/2-only" mode, no wrong behavior observed just an inefficiency, use -XX:CICompilerCount=1 = MLM = P4
02-05-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24972 Date: 2025-04-30 19:00:23 +0000
30-04-2025