RFR: JDK-8284758: [linux] improve print_container_info [v2]

Thomas Stuefe stuefe at openjdk.java.net
Wed Apr 13 16:59:25 UTC 2022


On Wed, 13 Apr 2022 16:27:52 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> Aren't these sizes page-aligned anyway?
>
> I don't see why. For example value `OSContainer::memory_limit_in_bytes()` comes from the cgroup interface files. Basically whatever the user specifies via the container engine's `--memory` switch. For example `--memory 123412332` is fine.
> 
> 
> $ sudo podman run --rm -ti --memory 128974848 --memory-swap 128974848 -v $(pwd)/build/linux-x86_64-server-release/images/jdk:/opt/jdk:z fedora:35 /opt/jdk/bin/java -Xlog:os+container=trace -version 2>&1 | grep -C2 memory.limit_in_bytes
> [0.001s][trace][os,container] Path to /memory.limit_in_bytes is /sys/fs/cgroup/memory/memory.limit_in_bytes
> [0.001s][trace][os,container] Memory Limit is: 128974848
> [0.001s][info ][os,container] Memory Limit is: 128974848

128974848 is still page aligned :-)

But okay, I think you are right and this is more precise. In Metaspace reports, I usually write "<1KB" for these cases (not 0 but smaller than 1K), but switching to bytes is also fine. User has to read carefully though.

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

PR: https://git.openjdk.java.net/jdk/pull/8217


More information about the hotspot-runtime-dev mailing list