Merge pull request #11034 from HuKeping/oom_kill_disable
enable cgroups memory.oom_control
This commit is contained in:
commit
d67fbb1516
1 changed files with 7 additions and 0 deletions
|
@ -18,6 +18,7 @@ type SysInfo struct {
|
||||||
CpuCfsQuota bool
|
CpuCfsQuota bool
|
||||||
IPv4ForwardingDisabled bool
|
IPv4ForwardingDisabled bool
|
||||||
AppArmor bool
|
AppArmor bool
|
||||||
|
OomKillDisable bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns a new SysInfo, using the filesystem to detect which features the kernel supports.
|
// New returns a new SysInfo, using the filesystem to detect which features the kernel supports.
|
||||||
|
@ -36,6 +37,12 @@ func New(quiet bool) *SysInfo {
|
||||||
if !sysInfo.SwapLimit && !quiet {
|
if !sysInfo.SwapLimit && !quiet {
|
||||||
logrus.Warn("Your kernel does not support swap memory limit.")
|
logrus.Warn("Your kernel does not support swap memory limit.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.oom_control"))
|
||||||
|
sysInfo.OomKillDisable = err == nil
|
||||||
|
if !sysInfo.OomKillDisable && !quiet {
|
||||||
|
logrus.Warnf("Your kernel does not support oom control.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if cgroupCpuMountpoint, err := cgroups.FindCgroupMountpoint("cpu"); err != nil {
|
if cgroupCpuMountpoint, err := cgroups.FindCgroupMountpoint("cpu"); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue