RFR: 8365606: Container code should not be using jlong/julong [v3]
Severin Gehwolf
sgehwolf at openjdk.org
Mon Nov 10 17:15:53 UTC 2025
On Mon, 10 Nov 2025 17:09:54 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> src/hotspot/os/linux/os_linux.cpp line 348:
>>
>>> 346: return true;
>>> 347: }
>>> 348: }
>>
>> This whole function is getting a bit too long in my opinion.
>> Maybe everything inside the `if OSContainer::is_containerized() {}` could be moved into a new function `OSContainer::available_swap_in_bytes`, similar to the already existing `OSContainer::available_memory_in_bytes`. That way, we could abstract away all the `OSContainer` calls.
>>
>> The only consequence would be that the `log_trace` wouldn't work any more. I couldn't find any test that depends on the exact output, so it could perhaps be split up instead.
>
> I've moved this to a `OSContainer::available_swap_in_bytes` function.
Example trace log (if it fails) is:
[0.672s][trace][os,container] OSContainer::available_swap_in_bytes: container_swap_limit=unlimited container_mem_limit=1073741824, host_free_swap: 8589844480
[0.672s][trace][os,container] os::free_swap_space: containerized value unavailable returning host value: 8589844480
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27743#discussion_r2511340779
More information about the hotspot-jfr-dev
mailing list