libct/cg/fs2.Stat: always call statCpu
Giuseppe found out that cpu.stat for a cgroup is available even if
the cpu controller is not enabled for it. So, let's call statCpu
regradress, and ignore ENOENT.
@@ -130,11 +130,10 @@ func (m *manager) GetStats() (*cgroups.Stats, error) {
}
}
// cpu (since kernel 4.15)
- if _, ok := m.controllers["cpu"]; ok {
- if err := statCpu(m.dirPath, st); err != nil {
+ // Note cpu.stat is available even if the controller is not enabled.
+ if err := statCpu(m.dirPath, st); err != nil && !os.IsNotExist(err) {
errs = append(errs, err)
}
- }
// hugetlb (since kernel 5.6)
if _, ok := m.controllers["hugetlb"]; ok {
if err := statHugeTlb(m.dirPath, st); err != nil {
