Add support for memory reservation
Signed-off-by: qhuang <qhuang@10.0.2.15>
This commit is contained in:
parent
22afd88a00
commit
f0bff37edc
2 changed files with 13 additions and 5 deletions
|
@ -31,6 +31,9 @@ type cgroupMemInfo struct {
|
|||
// Whether swap limit is supported or not
|
||||
SwapLimit bool
|
||||
|
||||
// Whether soft limit is supported or not
|
||||
MemoryReservation bool
|
||||
|
||||
// Whether OOM killer disalbe is supported or not
|
||||
OomKillDisable bool
|
||||
|
||||
|
|
|
@ -49,6 +49,10 @@ func checkCgroupMem(quiet bool) cgroupMemInfo {
|
|||
if !quiet && !swapLimit {
|
||||
logrus.Warn("Your kernel does not support swap memory limit.")
|
||||
}
|
||||
memoryReservation := cgroupEnabled(mountPoint, "memory.soft_limit_in_bytes")
|
||||
if !quiet && !memoryReservation {
|
||||
logrus.Warn("Your kernel does not support memory reservation.")
|
||||
}
|
||||
oomKillDisable := cgroupEnabled(mountPoint, "memory.oom_control")
|
||||
if !quiet && !oomKillDisable {
|
||||
logrus.Warnf("Your kernel does not support oom control.")
|
||||
|
@ -65,6 +69,7 @@ func checkCgroupMem(quiet bool) cgroupMemInfo {
|
|||
return cgroupMemInfo{
|
||||
MemoryLimit: true,
|
||||
SwapLimit: swapLimit,
|
||||
MemoryReservation: memoryReservation,
|
||||
OomKillDisable: oomKillDisable,
|
||||
MemorySwappiness: memorySwappiness,
|
||||
KernelMemory: kernelMemory,
|
||||
|
|
Loading…
Reference in a new issue