From 916c6a15397451e8d39f8d3f0134d9cfc776cb96 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 5 Oct 2021 16:48:15 -0700 Subject: [PATCH] libct/cg/fs2: fix GetStats for unsupported hugetlb In case hugetlb is not supported, GetStats() should not error out, and yet it does. Assume that if GetHugePageSize return an error, hugetlb is not supported (this is what cgroup v1 manager do). Fixes: 89a87adb Signed-off-by: Kir Kolyshkin --- libcontainer/cgroups/fs2/hugetlb.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libcontainer/cgroups/fs2/hugetlb.go b/libcontainer/cgroups/fs2/hugetlb.go index aed81a4b3..a228d3f25 100644 --- a/libcontainer/cgroups/fs2/hugetlb.go +++ b/libcontainer/cgroups/fs2/hugetlb.go @@ -1,7 +1,6 @@ package fs2 import ( - "fmt" "strconv" "github.com/opencontainers/runc/libcontainer/cgroups" @@ -27,10 +26,7 @@ func setHugeTlb(dirPath string, r *configs.Resources) error { } func statHugeTlb(dirPath string, stats *cgroups.Stats) error { - hugePageSizes, err := cgroups.GetHugePageSize() - if err != nil { - return fmt.Errorf("failed to fetch hugetlb info: %w", err) - } + hugePageSizes, _ := cgroups.GetHugePageSize() hugetlbStats := cgroups.HugetlbStats{} for _, pagesize := range hugePageSizes {