Skip to content

Commit bb47798

Browse files
authored
Merge pull request #24 from gavinkflam/fix-cg2-hugetlb-stat
fs2: Fix statHugeTlb error when rsvd usage is present
2 parents b970779 + 94067f2 commit bb47798

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)