Merge pull request #14006 from hqhq/hq_add_kmem_limit
Add support for kernel memory limit
This commit is contained in:
commit
48cce1cd42
2 changed files with 8 additions and 0 deletions
|
@ -36,6 +36,9 @@ type cgroupMemInfo struct {
|
||||||
|
|
||||||
// Whether memory swappiness is supported or not
|
// Whether memory swappiness is supported or not
|
||||||
MemorySwappiness bool
|
MemorySwappiness bool
|
||||||
|
|
||||||
|
// Whether kernel memory limit is supported or not
|
||||||
|
KernelMemory bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type cgroupCPUInfo struct {
|
type cgroupCPUInfo struct {
|
||||||
|
|
|
@ -57,12 +57,17 @@ func checkCgroupMem(quiet bool) cgroupMemInfo {
|
||||||
if !quiet && !memorySwappiness {
|
if !quiet && !memorySwappiness {
|
||||||
logrus.Warnf("Your kernel does not support memory swappiness.")
|
logrus.Warnf("Your kernel does not support memory swappiness.")
|
||||||
}
|
}
|
||||||
|
kernelMemory := cgroupEnabled(mountPoint, "memory.kmem.limit_in_bytes")
|
||||||
|
if !quiet && !kernelMemory {
|
||||||
|
logrus.Warnf("Your kernel does not support kernel memory limit.")
|
||||||
|
}
|
||||||
|
|
||||||
return cgroupMemInfo{
|
return cgroupMemInfo{
|
||||||
MemoryLimit: true,
|
MemoryLimit: true,
|
||||||
SwapLimit: swapLimit,
|
SwapLimit: swapLimit,
|
||||||
OomKillDisable: oomKillDisable,
|
OomKillDisable: oomKillDisable,
|
||||||
MemorySwappiness: memorySwappiness,
|
MemorySwappiness: memorySwappiness,
|
||||||
|
KernelMemory: kernelMemory,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue