diff --git a/sysinfo/sysinfo.go b/sysinfo/sysinfo.go index aea857f..c4ca4a2 100644 --- a/sysinfo/sysinfo.go +++ b/sysinfo/sysinfo.go @@ -36,6 +36,9 @@ type cgroupMemInfo struct { // Whether memory swappiness is supported or not MemorySwappiness bool + + // Whether kernel memory limit is supported or not + KernelMemory bool } type cgroupCPUInfo struct { diff --git a/sysinfo/sysinfo_linux.go b/sysinfo/sysinfo_linux.go index 4f496a1..84e3ceb 100644 --- a/sysinfo/sysinfo_linux.go +++ b/sysinfo/sysinfo_linux.go @@ -57,12 +57,17 @@ func checkCgroupMem(quiet bool) cgroupMemInfo { if !quiet && !memorySwappiness { 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{ MemoryLimit: true, SwapLimit: swapLimit, OomKillDisable: oomKillDisable, MemorySwappiness: memorySwappiness, + KernelMemory: kernelMemory, } }