RFR: 8302744: Refactor Hotspot container detection code [v3]

Severin Gehwolf sgehwolf at openjdk.org
Thu May 23 14:00:30 UTC 2024


> Please review this container detection code refactoring in hotspot. The main point of this is to
> 
> - get rid of the `GET_CONTAINER_INFO` macros which hide too many things under the hood
> - prevent refactoring of the code (since `GET_CONTAINER_INFO` macros short-return and are therefore not portable; at least not without some risk)
> - make the code easier to understand
> - allow for better testing via `gtest`
> - separate multi-line parsing from single line parsing for clarity.
> 
> Testing:
> - [x] GHA
> - [x] `gtest:cgroupTest` tests
> - [x] Container tests on Linux with cgroup v1 (legacy) and cgroup v2. All pass.
> 
> Thoughts?

Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 16 additional commits since the last revision:

 - Add proper comments for parsing utility functions
 - Add a test for a large string read
 - Add convenience function for 'max' handling
   
   This now makes limit_from_str a private method
 - Fix general read string cases.
 - Get rid of the templated function
 - Use enum class for TupleValue
 - Merge branch 'master' into jdk-8302744-cleanup-getcontainer-info
 - Fix TestMemoryAwareness for cgroup v2
   
   It only reads the swap value, thus doesn't print:
   "Memory and Swap Limit is" but rather prints:
   "Swap Limit is". This is fine, since for cg v2
   the memory limit and the swap limits are in different
   files.
 - Fix whitespace
 - Handle cpu quota for cgroups v1 specially
 - ... and 6 more: https://git.openjdk.org/jdk/compare/3087b5fc...c41d3183

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19060/files
  - new: https://git.openjdk.org/jdk/pull/19060/files/9ac1b407..c41d3183

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19060&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19060&range=01-02

  Stats: 43820 lines in 615 files changed: 35563 ins; 5972 del; 2285 mod
  Patch: https://git.openjdk.org/jdk/pull/19060.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19060/head:pull/19060

PR: https://git.openjdk.org/jdk/pull/19060


More information about the hotspot-runtime-dev mailing list