Merge pull request #853 from hqhq/fix_set_kernel_memory
Remove use_hierarchy check when set kernel memory
This commit is contained in:
commit
88bb59e35f
|
@ -76,22 +76,13 @@ func (s *MemoryGroup) SetKernelMemory(path string, cgroup *configs.Cgroup) error
|
||||||
}
|
}
|
||||||
|
|
||||||
if !kmemInitialized {
|
if !kmemInitialized {
|
||||||
// If hierarchy is set, we can't change the limit
|
|
||||||
usesHierarchy, err := getCgroupParamUint(path, "memory.use_hierarchy")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if usesHierarchy != 0 {
|
|
||||||
return fmt.Errorf("cannot initialize kmem.limit_in_bytes if use_hierarchy is already set")
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there's already tasks in the cgroup, we can't change the limit either
|
// If there's already tasks in the cgroup, we can't change the limit either
|
||||||
tasks, err := getCgroupParamString(path, "tasks")
|
tasks, err := getCgroupParamString(path, "tasks")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if tasks != "" {
|
if tasks != "" {
|
||||||
return fmt.Errorf("cannot initialize kmem.limit_in_bytes after task have joined this cgroup")
|
return fmt.Errorf("cannot set kmem.limit_in_bytes after task have joined this cgroup")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue