RFR: 8356000: C1/C2-only modes use 2 compiler threads on 1 CPU machine

Aleksey Shipilev shade at openjdk.org
Wed Apr 30 19:08:31 UTC 2025


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. 

Additional testing:
 - [x] New regression test passes with the fix, fails without it
 - [ ] GHA

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

Commit messages:
 - Unnecessary arch limitation
 - Simplify test
 - Adjust test bound
 - Fix

Changes: https://git.openjdk.org/jdk/pull/24972/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24972&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8356000
  Stats: 83 lines in 2 files changed: 78 ins; 1 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/24972.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24972/head:pull/24972

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


More information about the hotspot-compiler-dev mailing list