RFR: 8366847: JFR reports incorrect number of cores on hybrid CPU [v3]

David Holmes dholmes at openjdk.org
Fri Oct 3 06:58:48 UTC 2025


On Thu, 2 Oct 2025 06:10:05 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

>> Sorry I don't follow this change. If there is a division-by-zero problem then don't we need a fix the method that would report zero i.e. `threads_per_core()` or `cores_per_cpu()` ??
>
> I want to use number of logical processors from `CPUID` instruction directly because we can't believe `threads_per_core()` on hybrid CPU. Some of cores (e.g. E cores) might not have hyper threading even though `CPUID` reports HT flag.
> Thus I think we have to check the value here.

Okay but this is not a JFR specific change - you are changing these values for all clients of the VM version info.

Let me walk through an example to see if I have it right:

We have a hybrid system with two sockets, each of which has 6P and 2E cores. Only the P cores have hyper-threading even though the HT bit is set. So the current code would do:

_no_of_threads = 28  // I hope that is what the OS reports: 2 * (6*2 + 2)
threads_per_core()  = 2   // because of HT bit
cores_per_cpu() = 8
threads_per_package = 2 * 8 = 16
_no_of_sockets = 28 / 16 = 1   // integer division -> gives wrong answer

with new code:

threads_per_package = 14   // direct from CPUID logical processors
_no_of_sockets = 28 / 14 = 12

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27080#discussion_r2400974344


More information about the hotspot-dev mailing list