Skip to content

Commit

Permalink
libct/cg/fs2: fix GetStats for unsupported hugetlb
Browse files Browse the repository at this point in the history
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: 89a87ad
Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit 916c6a1)
Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
kolyshkin authored and AkihiroSuda committed Nov 29, 2021
1 parent 3125814 commit 8e96a96
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions libcontainer/cgroups/fs2/hugetlb.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,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 errors.Wrap(err, "failed to fetch hugetlb info")
}
hugePageSizes, _ := cgroups.GetHugePageSize()
hugetlbStats := cgroups.HugetlbStats{}

for _, pagesize := range hugePageSizes {
Expand Down

0 comments on commit 8e96a96

Please sign in to comment.