fix(host): check subgroup enabled on cgroup init

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
This commit is contained in:
wanyaoqi
2023-04-19 17:56:00 +08:00
parent 2466bf277e
commit 7324d99748
+4
View File
@@ -380,10 +380,14 @@ func (c *CGroupTask) init() bool {
re := regexp.MustCompile(`\s+`)
scanner := bufio.NewScanner(file)
for scanner.Scan() {
// #subsys_name hierarchy num_cgroups enabled
line := scanner.Text()
if line[0] != '#' {
parts := re.Split(line, -1)
module := parts[0]
if parts[3] == "0" { // disabled
continue
}
if !ModuleIsMounted(module) {
moduleDir := path.Join(cgroupsPath, module)
if !fileutils2.Exists(moduleDir) {