Skip to content

Commit 94067f2

Browse files
committed
fs2: Fix statHugeTlb error when rsvd usage is present
Signed-off-by: Gavin Lam <[email protected]>
1 parent b970779 commit 94067f2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs2/hugetlb.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ func setHugeTlb(dirPath string, r *cgroups.Resources) error {
4343
func statHugeTlb(dirPath string, stats *cgroups.Stats) error {
4444
hugetlbStats := cgroups.HugetlbStats{}
4545
rsvd := ".rsvd"
46+
4647
for _, pagesize := range cgroups.HugePageSizes() {
48+
prefix := "hugetlb." + pagesize
4749
again:
48-
prefix := "hugetlb." + pagesize + rsvd
49-
value, err := fscommon.GetCgroupParamUint(dirPath, prefix+".current")
50+
value, err := fscommon.GetCgroupParamUint(dirPath, prefix+rsvd+".current")
5051
if err != nil {
5152
if rsvd != "" && errors.Is(err, os.ErrNotExist) {
5253
rsvd = ""

0 commit comments

Comments
 (0)