RFR: 8365606: Container code should not be using jlong/julong
Severin Gehwolf
sgehwolf at openjdk.org
Mon Sep 8 16:15:22 UTC 2025
Please review this refactoring to the container code in Hotspot to no longer use `jlong` and `julong`. Instead this patch proposes to move to `size_t` and `ssize_t` types. In a similar manner as was done with the `os::xxx` APIs in [JDK-8357086](https://bugs.openjdk.org/browse/JDK-8357086). With this patch the use of `OSCONTAINER_ERROR` (`-2`) is largely gone. It's not terribly useful to have to warrant the many special cases throughout the code.
In this patch failure handling is being done by returning a boolean for success/failure of reading a value from the interface files. The notion of "not supported" is being folded into `-1` (unlimited for limit values, not supported for usage values). Note that the code already treated `-1` and `-2` similarly. The few cases where `-2` was actually used was in `VM.info` output or `hserr` files. Where `-2` was being treated as "not supported". However, file-reading errors would also fall into the `-2` bucket making the "not supported" case not 100% distinguishable either. The simplification here proposes to do away with `-2` (other than in traces) and fold it into the `-1` (unlimited) bucket as that's how the code has been handling those values (even prior to this patch).
Testing:
- [x] GHA (tier1)
- [x] cgroup gtests and hotspot container tests on cgroup v1 and cgroup v2 (no regressions noted).
Thoughts?
-------------
Commit messages:
- Improve commenting in os_linux.cpp
- Fix compilation error on arm (32 bit)
- Merge branch 'master' into jdk-8365606-size_t-container-subsys
- Modify OSContainer API to use ssize_t/size_t
- 8365606: container code should not be using julong
Changes: https://git.openjdk.org/jdk/pull/27125/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27125&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8365606
Stats: 873 lines in 14 files changed: 300 ins; 67 del; 506 mod
Patch: https://git.openjdk.org/jdk/pull/27125.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/27125/head:pull/27125
PR: https://git.openjdk.org/jdk/pull/27125
More information about the hotspot-dev
mailing list