RFR: 8365606: Container code should not be using jlong/julong [v2]

Severin Gehwolf sgehwolf at openjdk.org
Mon Nov 10 13:55:39 UTC 2025


On Mon, 27 Oct 2025 19:48:58 GMT, Thomas Fitzsimmons <fitzsim at openjdk.org> wrote:

>> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
>> 
>>  - Merge branch 'master' into jdk-8365606-jlong-julong-refactor
>>  - Fix print_container_info output
>>  - whitespace clean-ups and other small fixes
>>  - Fix log format in container macro and scanf format
>>  - Fix duplicate include in osContainer_linux
>>  - 8365606: Container code should not be using jlong/julong
>
> src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp line 470:
> 
>> 468:   // cast to int since the read value might be negative
>> 469:   // and we want to avoid logging -1 as a large unsigned value.
>> 470:   int quota_int = static_cast<int>(quota);
> 
> It seems like quota is either a positive number or disabled.  I wonder if `result` can be treated as a `uint64_t`, and this log message special-cased to detect `-1` read from `/cpu.cfs_quota_us` as disabled.  I guess the calling code would need another way to differentiate "disabled" from other values... maybe with `0`?  Just a thought to maybe simplify the type logic here.  Likewise for `period` and `shares`.

Yes, there is opportunity to change the API. This patch was done to do a 1-to-1 translation of the previous version as much as possible. So I've refrained from doing this in this patch as well. It kept the size of the patch a bit more manageable. Happy to file a follow-up RFE to do this in a separate patch. Thoughts?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27743#discussion_r2510666794


More information about the hotspot-jfr-dev mailing list