Merge pull request #10778 from zvonkok/kata-agent-cgroupsV2

agent: Ensure proper cgroupsV2 handling with init_mode=true
This commit is contained in:
Fupan Li 2025-01-23 14:00:13 +08:00 committed by GitHub
commit ebd8ec227b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -299,7 +299,13 @@ pub fn cgroups_mount(logger: &Logger, unified_cgroup_hierarchy: bool) -> Result<
// Enable memory hierarchical account.
// For more information see https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt
online_device("/sys/fs/cgroup/memory/memory.use_hierarchy")
// cgroupsV2 will automatically enable memory.use_hierarchy.
// additinoally this directory layout is not present in cgroupsV2.
if !unified_cgroup_hierarchy {
return online_device("/sys/fs/cgroup/memory/memory.use_hierarchy");
}
Ok(())
}
#[instrument]