Merge pull request #2470 from katarzyna-z/kk-fix-numa-stats

Fix #2469 omit memory.numa_stat when not available
This commit is contained in:
Akihiro Suda 2020-06-16 09:32:49 +09:00 committed by GitHub
commit c76af1d2ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -291,7 +291,9 @@ func getPageUsageByNUMA(cgroupPath string) (cgroups.PageUsageByNUMA, error) {
stats := cgroups.PageUsageByNUMA{}
file, err := os.Open(path.Join(cgroupPath, cgroupMemoryPagesByNuma))
if err != nil {
if os.IsNotExist(err) {
return stats, nil
} else if err != nil {
return stats, err
}

View File

@ -504,3 +504,14 @@ func TestNoHierarchicalNumaStat(t *testing.T) {
}
expectPageUsageByNUMAEquals(t, pageUsageByNUMA, actualStats)
}
func TestWithoutNumaStat(t *testing.T) {
helper := NewCgroupTestUtil("memory", t)
defer helper.cleanup()
actualStats, err := getPageUsageByNUMA(helper.CgroupPath)
if err != nil {
t.Fatal(err)
}
expectPageUsageByNUMAEquals(t, cgroups.PageUsageByNUMA{}, actualStats)
}