Skip to content

Commit f810d44

Browse files
committed
hugetlb: correctly parse hugetlb.<size>.events files
1 parent f1e92d8 commit f810d44

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cgroup2/utils.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,17 @@ func readHugeTlbStats(path string) []*stats.HugeTlbStat {
419419
hpSizes := hugePageSizes()
420420
usage := make([]*stats.HugeTlbStat, len(hpSizes))
421421
for idx, pagesize := range hpSizes {
422+
events := make(map[string]uint64)
423+
err := readKVStatsFile(path, "hugetlb."+pagesize+".events", events)
424+
if err != nil {
425+
log.L.WithError(err).Errorf("failed to read hugetlb events for %s", filepath.Join(path, "hugetlb."+pagesize+".events", events))
426+
}
427+
422428
usage[idx] = &stats.HugeTlbStat{
423429
Max: getStatFileContentUint64(filepath.Join(path, "hugetlb."+pagesize+".max")),
424430
Current: getStatFileContentUint64(filepath.Join(path, "hugetlb."+pagesize+".current")),
425431
Pagesize: pagesize,
426-
Failcnt: getStatFileContentUint64(filepath.Join(path, "hugetlb."+pagesize+".events")),
432+
Failcnt: events["max"],
427433
}
428434
}
429435
return usage

0 commit comments

Comments
 (0)