Commit 806ed32
refactor cgroup to allow multiple properties per controller
The previous Cgroup implementation used a separate object per
every cgroup property. This lead to additional calls to
create_dir_all and writes to cgroup.procs, especially in
cgroupsv2 where there is only one hierarchy.
This change prevents the duplication by refactoring the code into:
- CgroupConfiguration: this holds multiple cgroup properties in
multiple cgroup controllers and hierarchies
- Cgroup: this holds the configuration for a hierarchy and holds
multiple properties
- CgroupProperty: a file to value mapping of the cgroup properties
to be written.
The CgroupBuilder is changed to a CgroupConfigurationBuilder so that
the setup of the Cgroup is abstracted away from the environment.
Additionally, in the CgroupV2 the available controllers read from
cgroup.controllers are cached to avoid multiple unnecessary reads.
Signed-off-by: Riccardo Mancini <mancio@amazon.com>1 parent e2fceff commit 806ed32
0 commit comments