RFR: 8367319: Add os interfaces to get machine and container values separately [v5]
David Holmes
dholmes at openjdk.org
Thu Dec 4 06:53:04 UTC 2025
On Wed, 3 Dec 2025 15:15:45 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> Casper Norrbin has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
>>
>> - return false when no limit + removed unneeded asserts
>> - Merge branch 'master' into separate-container-machine-values
>> - Merge branch 'master' into separate-container-machine-values
>> - Merge branch 'master' into separate-container-machine-values
>> - Move methods to Machine/Container inner classes + clarifying documentation
>> - Merge branch 'master' into separate-container-machine-values
>> - Fixed print type
>> - separate-machine-container-functions
>
> src/hotspot/os/linux/os_linux.cpp line 222:
>
>> 220: return true;
>> 221: }
>> 222: return false;
>
> Assume this usage:
>
> physical_memory_size mem_limit = 0;
> if (!os::Container::memory_limit(mem_limit)) {
> // assume mem_limit == 0;
> }
>
>
> The general contract for cases where a function returned `false` (i.e. error) is that the passed in reference remains untouched. This seems to violate that contract. `value` could change from whatever the initial value was to `value_unlimited` and return `false`.
I don't see a specification for any of these bool-returning functions with out-parameters (whether already existing or new here) so I'm not quite sure how to read a lot of them. Does returning true mean asking about a limit was successful, or that it was successful and there is a limit? Do the low-level functions have the same behaviour as the higher-level ones?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27646#discussion_r2587796557
More information about the hotspot-dev
mailing list