Skip to content

Commit 99469eb

Browse files
committed
Handle kmem.limit_in_bytes removal
kmem.limit_in_bytes has been removed in upstream linux and this patch is queued to be backported to linux 6.1 stable: - https://lore.kernel.org/linux-mm/[email protected]/T/ - https://www.spinics.net/lists/stable-commits/msg316619.html Without this change to libcontainerd, GetStats() will return an error on the latest kernel(s). A downstream effect is that Kubernetes's kubelet does not start up. This fix was tested by ensuring that it unblocks kubelet startup when running on the latest kernel. Signed-off-by: Jordan Rife <[email protected]>
1 parent 1d9b158 commit 99469eb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libcontainer/cgroups/fs/memory.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ func getMemoryData(path, name string) (cgroups.MemoryData, error) {
234234
memoryData.Failcnt = value
235235
value, err = fscommon.GetCgroupParamUint(path, limit)
236236
if err != nil {
237+
if name == "kmem" && os.IsNotExist(err) {
238+
// Ignore ENOENT as kmem.limit_in_bytes has
239+
// been removed in newer kernels.
240+
return memoryData, nil
241+
}
242+
237243
return cgroups.MemoryData{}, err
238244
}
239245
memoryData.Limit = value

0 commit comments

Comments
 (0)