RFR: 8334254: Cleanup CGroups initialization code

Johan Sjölen jsjolen at openjdk.org
Thu Jun 13 19:27:46 UTC 2024


Hi,

Please consider this patch which attempts to improve the code quality of some of the cgroups code, somewhat.

1. Get rid of `#define`s and upgrade to a `CG_INFO` enum, with some helpers
2. Make some of the code prettier by removing copy-pasted and edited code
3. Make `CgroupInfo` RAII, ridding us of the `cleanup` function
4. `set_subsystem_path` is **only** used at construction time, only call it at that time and make those functions private. Also remove `virtual`ness, as this is unnecessary now.

Testing:

1. cgroupTest group in gtest.

Thank you.

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

Commit messages:
 - Copyright, includes
 - Simplify loop slightly
 - Make set_subsystem_path private
 - Get rid of virtual set_subsystem_path
 - Get rid of set_subsystem_path
 - Get rid of unnecessary loop
 - Get rid of some more code
 - Fix includes
 - RAII CgroupInfo
 - Enumify CG_INFO

Changes: https://git.openjdk.org/jdk/pull/19709/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19709&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8334254
  Stats: 163 lines in 5 files changed: 26 ins; 74 del; 63 mod
  Patch: https://git.openjdk.org/jdk/pull/19709.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19709/head:pull/19709

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


More information about the hotspot-runtime-dev mailing list