Conversation
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupV1.java
Fixed
Show fixed
Hide fixed
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupManager.java
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/util/platforms/unix/linux/LinuxSystemResourceController.java
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupV2.java
Outdated
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupManager.java
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupV1.java
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupManager.java
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/util/platforms/unix/linux/LinuxSystemResourceController.java
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/util/platforms/unix/linux/LinuxSystemResourceController.java
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/util/platforms/unix/linux/LinuxSystemResourceController.java
Outdated
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupV1.java
Show resolved
Hide resolved
006465c to
732f814
Compare
|
Binary incompatibility detected for commit 0d718da. com.aws.greengrass.componentmanager.KernelConfigResolver is binary incompatible and is source incompatible because of METHOD_REMOVED Produced by binaryCompatability.py |
|
Unit Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against 0d718da |
|
Integration Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against 0d718da |
732f814 to
73f67e3
Compare
src/main/java/com/aws/greengrass/util/platforms/unix/linux/LinuxSystemResourceController.java
Outdated
Show resolved
Hide resolved
| return LinuxSystemResourceController.CgroupFreezerState.valueOf( | ||
| new String(Files.readAllBytes(Cgroup.Freezer.getCgroupFreezerStateFilePath(serviceName)), | ||
| StandardCharsets.UTF_8).trim()); | ||
| private boolean isCgroupV2() { |
There was a problem hiding this comment.
Is there only one cgroup v2 path we can ever use?
There was a problem hiding this comment.
/sys/fs/cgroup/cgroup.controllers is the standard and reliable path for detecting cgroup v2. This file only exists when the unified hierarchy is mounted, so checking it is sufficient. (reference: https://rootlesscontaine.rs/getting-started/common/cgroup2/#checking-whether-cgroup-v2-is-already-enabled)
...va/com/aws/greengrass/integrationtests/lifecyclemanager/GenericExternalServiceIntegTest.java
Outdated
Show resolved
Hide resolved
...va/com/aws/greengrass/integrationtests/lifecyclemanager/GenericExternalServiceIntegTest.java
Outdated
Show resolved
Hide resolved
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupManager.java
Outdated
Show resolved
Hide resolved
| enableControllersInRoot(); | ||
|
|
||
| // enable controllers in greengrass cgroup for component delegation | ||
| enableControllersInGreengrass(); |
There was a problem hiding this comment.
Do we need to enable the same controllers over and over again for every GG component? I think it's enough to do it once.
There was a problem hiding this comment.
If the component is started as a child process (it should be, right?) it will inherit the cgroup.
There was a problem hiding this comment.
I suppose a plugin component would just add on to the existing process.
There was a problem hiding this comment.
Great point, I've updated the logic to enable the controller only once.
src/main/java/com/aws/greengrass/util/platforms/unix/linux/CgroupV2.java
Show resolved
Hide resolved
142a84a to
1f96f57
Compare
1f96f57 to
0d718da
Compare
Issue #, if available:
Description of changes:
Feature: add support for Linux cgroup version 2
Added logic to dynamically detect the cgroup version via /sys/fs/cgroup/cgroup.controllers.
Introduced new CgroupV2Manager implementation to handle unified hierarchy.
Extended existing CgroupManager interface for common APIs (e.g., CPU/memory limits, freeze/thaw).
Re-enabled integration tests to verify freeze/thaw and memory/CPU limit behavior under cgroup v2 environments.
Why is this change necessary:
Greengrass currently supports only cgroup v1 controllers. Newer Linux distributions (e.g., Ubuntu 22+, Amazon Linux 2023) use cgroup v2 by default, therefore resource-limit and process-freezing features will not work.
This change ensures Nucleus can operate correctly on both cgroup versions.
How was this change tested:
Any additional information or context required to review the change:
Documentation Checklist:
Compatibility Checklist:
any deprecated method or type.
Refer to Compatibility Guidelines for more information.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.