From 9dedba65f5fcec813d534a2e67d94e32aa8fb2d7 Mon Sep 17 00:00:00 2001 From: "Maciej \"Iwan\" Iwanowski" Date: Fri, 5 Feb 2021 23:31:14 +0100 Subject: [PATCH] Fixes #2783 - takes package ID into consideration when calculating count of unique properties Signed-off-by: Maciej "Iwan" Iwanowski --- utils/sysfs/sysfs.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/utils/sysfs/sysfs.go b/utils/sysfs/sysfs.go index a4787399c88..e8b88f2f4a5 100644 --- a/utils/sysfs/sysfs.go +++ b/utils/sysfs/sysfs.go @@ -15,6 +15,7 @@ package sysfs import ( + "bytes" "fmt" "io/ioutil" "os" @@ -485,7 +486,14 @@ func GetUniqueCPUPropertyCount(cpuBusPath string, propertyName string) int { klog.Warningf("Cannot open %s, assuming 0 for %s of CPU %d", propertyPath, propertyName, cpuID) propertyVal = []byte("0") } - uniques[string(propertyVal)] = true + packagePath := filepath.Join(sysCPUPath, sysFsCPUTopology, CPUPhysicalPackageID) + packageVal, err := ioutil.ReadFile(packagePath) + if err != nil { + klog.Warningf("Cannot open %s, assuming 0 %s of CPU %d", packagePath, CPUPhysicalPackageID, cpuID) + packageVal = []byte("0") + + } + uniques[fmt.Sprintf("%s_%s", bytes.TrimSpace(propertyVal), bytes.TrimSpace(packageVal))] = true } return len(uniques) }