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

Thomas Fitzsimmons fitzsim at openjdk.org
Mon Nov 10 14:27:50 UTC 2025


On Mon, 10 Nov 2025 13:53:11 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> 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?

Maybe the API as-is is clearer, because it matches the actual `/proc` values.  Having thought about it more, it probably doesn't make sense to change the API just to make the implementation's type handling cleaner, so I'd say don't bother with the follow-up RFE.

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

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


More information about the hotspot-jfr-dev mailing list