RFR: 8292083: Detected container memory limit may exceed physical machine memory [v15]
Jonathan Dowland
jdowland at openjdk.org
Tue Aug 23 13:45:57 UTC 2022
On Tue, 23 Aug 2022 13:29:25 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> Jonathan Dowland has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Remove superfluous log line from os::Linux::available_memory
>>
>> Now that os::Linux::available_memory calls
>> OSContainer::memory_limit_in_bytes, we can remove a log_debug
>> that replicates the logging that takes place there.
>
> src/hotspot/os/linux/os_linux.cpp line 199:
>
>> 197: jlong mem_limit = OSContainer::memory_limit_in_bytes();
>> 198: jlong mem_usage = OSContainer::memory_usage_in_bytes();
>> 199: if (mem_limit > 0 && mem_usage < 1) {
>
> This will run into the `OSContainer::memory_usage_in_bytes()` is not cached problem (you should notice this that the logs are more noisy). A pattern like:
>
>
> jlong mem_limit = OSContainer::memory_limit_in_bytes();
> jlong mem_usage;
> if (mem_limit > 0 && (mem_usage = OSContainer::memory_usage_in_bytes()) < 1) {
> [...]
>
>
> Works better due to short-circuiting `and`-expression.
Good catch, sorry, I think it was that way in the first place (I've undone it over-zealously in the name of legibility). Fixed in ac6469310bc.
-------------
PR: https://git.openjdk.org/jdk/pull/9880
More information about the hotspot-runtime-dev
mailing list