RFR: 8371408: [Linux] VM.info output for container information is confusing

Severin Gehwolf sgehwolf at openjdk.org
Thu Dec 11 13:50:04 UTC 2025


On Thu, 11 Dec 2025 12:02:22 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:

> Hi everyone,
> 
> The current `VM.info` printout for container limits can be made clearer and easier to read. The original formatting was designed around cgroup v1, directly mirroring its file names and conventions. Since then, most environments have transitioned to cgroup v2. While the output is still correct, its readability suffers. For example, memory metrics have a `_in_bytes` suffix, but the printed values are actually in kilobytes with a `k` suffix.
> 
> This PR removes the `_in_*` suffixes from metric names and adds appropriate units (e.g. `kB`, `us`) directly to the values. At the same time, I have also improved the formatting of the output so that all values and units are column-aligned, similar to the `/proc/meminfo` section immediately above in the `VM.info` printout.
> 
> 
> Here is the container printout before:
> 
> container (cgroup) information:
> container_type: cgroupv1
> cpu_cpuset_cpus: 0-15
> cpu_memory_nodes: 0-1
> active_processor_count: 16, but overridden by -XX:ActiveProcessorCount 8
> cpu_quota: 1600000
> cpu_period: 100000
> cpu_shares: no shares
> cpu_usage_in_micros: 2648091
> memory_limit_in_bytes: 4194304 k
> memory_and_swap_limit_in_bytes: 8388608 k
> memory_soft_limit_in_bytes: unlimited
> memory_throttle_limit_in_bytes: unavailable
> memory_usage_in_bytes: 61116 k
> memory_max_usage_in_bytes: 61116 k
> rss_usage_in_bytes: 56332 k
> cache_usage_in_bytes: 1880 k
> kernel_memory_limit_in_bytes: unlimited
> kernel_memory_usage_in_bytes: 1584 k
> kernel_memory_max_usage_in_bytes: 1644 k
> maximum number of tasks: unlimited
> current number of tasks: 17
> 
> 
> And here it is after:
> 
> container (cgroup) information:
> container_type:               cgroupv1
> cpu_cpuset_cpus:                  0-15
> cpu_memory_nodes:                  0-1
> active_processor_count:              8 (from -XX:ActiveProcessorCount)
> cpu_quota:                     1600000
> cpu_period:                     100000
> cpu_shares:                  no shares
> cpu_usage:                     2648091 us
> memory_limit:                  4194304 kB
> memory_and_swap_limit:         8388608 kB
> memory_soft_limit:           unlimited
> memory_throttle_limit:     unavailable
> memory_usage:                    61116 kB
> memory_max_usage:                61116 kB
> rss_usage:                       56332 kB
> cache_usage:                      1880 kB
> kernel_memory_limit:         unlimited
> kernel_memory_usage:              1584 kB
> kernel_memory_max_usage:          1644 kB
> maximum number of tasks:     unlimited
> current number of tasks:            17
> 
> 
> To accomplish ...

Nice work! I like it.

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

Marked as reviewed by sgehwolf (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28766#pullrequestreview-3567531682


More information about the hotspot-runtime-dev mailing list