Withdrawn: 8354727: CompilationPolicy creates too many compiler threads when code cache space is scarce

Manuel Hässig mhaessig at openjdk.org
Mon Jun 16 08:56:43 UTC 2025


On Thu, 12 Jun 2025 07:19:40 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:

> # Issue Summary
> 
> Running 
> 
> java -XX:+SegmentedCodeCache -XX:ReservedCodeCacheSize=10M -XX:NonNMethodCodeHeapSize=6M \
>      -XX:ProfiledCodeHeapSize=5M -XX:NonProfiledCodeHeapSize=5M -version
> 
> on a machine with more than 255 cores, this would fail with the message that the specified `NonNMethodCodeHeapSize` is too small to fit all compiler buffers (instead of failing because the sum of the heaps is larger than the `ReservedCodeCacheSize`). Hence, the calculated compiler count is too high. This is due to  `CompilationPolicy::initialize()` checking how many compiler buffers fit into the `ReservedCodeCacheSize`. However, in the case above, this is significantly larger than `NonNMethodCodeHeapSize` and causes a new check introduced in #17244 to fail.
> 
> # Changes
> 
> This PR fixes the calculation of the `CICompilerCount` ergonomic. Firstly, @shipilev kindly provided a fix for the compiler buffer size used in the calculation is also correct if we only have C2. Secondly,`NonNMethodHeapSize`is used as the maximum buffers size available for compilers buffers instead of `ReservedCodeCacheSize` if it was provided as a commandline flag.
> 
> It might be debatable if this is the correct fix, since the `NonNMethodHeap` can spill into the other heaps if it is too small. However, I am of the opinion that if the `NonNMethodHeapSize` is explicitly specified, then the compiler count should be calculated accordingly.
> 
> # Testing
> 
>  - [x] [GHA](https://github.com/mhaessig/jdk/actions/runs/15603409859)
>  - [x] tier1 and tier2 plus Oracle internal testing on our supported platforms
>  - [x] tier1 with a manually fixed core count of 288 (this reproduced the problem before the fix)

This pull request has been closed without being integrated.

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

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


More information about the hotspot-compiler-dev mailing list