RFR: 8356868: Not all cgroup parameters are made available [v2]
Gerard Ziemski
gziemski at openjdk.org
Fri Jun 20 16:56:31 UTC 2025
On Wed, 4 Jun 2025 11:33:03 GMT, Casper Norrbin <cnorrbin at openjdk.org> wrote:
>> Hi everyone,
>>
>> This PR improves cgroup support by exposing additional parameters that are currently not available. These parameters would enable more advanced features that rely on CPU and memory usage data.
>>
>> The new parameters are:
>>
>> - CPU usage: `cpuacct.usage` (cgroup v1) and `cpu.stat` (cgroup v2), which allow precise tracking of consumed CPU time.
>>
>> - Peak memory usage: `memory.peak` (cgroup v2). While the cgroup v1 equivalent (`memory.max_usage_in_bytes`) was already available, cgroup v2 previously returned `OSCONTAINER_ERROR` — this has now been fixed.
>>
>> - Memory throttle limit: `memory.high` (cgroup v2). There is no direct equivalent in cgroup v1, but since most systems use cgroup v2, exposing this parameter enables finer-grained memory control for those systems.
>>
>> Testing:
>> - All container tests under `/test/hotspot/jtreg/containers/`
>> - Manually inspected the new parameters in both cgroup v1 and v2 container environments with the relevant settings applied.
>
> Casper Norrbin has updated the pull request incrementally with one additional commit since the last revision:
>
> update cpu usage to use >=
>
> Co-authored-by: Severin Gehwolf <jerboaa at gmail.com>
LGTM, though I did have one feedback.
src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp line 431:
> 429: return (jlong)cpu_usage / 1000;
> 430: }
> 431:
Why don't we report the original value in nanos, if it is available?
This is new API, so no-one is using this yet, right?
-------------
Marked as reviewed by gziemski (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/25388#pullrequestreview-2946799576
PR Review Comment: https://git.openjdk.org/jdk/pull/25388#discussion_r2159367227
More information about the hotspot-runtime-dev
mailing list