From d37c6e370d817f66a49596ee64ac5a51b41c2c35 Mon Sep 17 00:00:00 2001 From: Peteris Rudzusiks Date: Mon, 15 May 2023 16:03:33 +0200 Subject: [PATCH] resource-control: fix setting CPU affinities on Linux With this fix the vCPU pinning feature chooses the correct physical cores to pin the vCPU threads on rather than always using core 0. Fixes #6831 Signed-off-by: Peteris Rudzusiks --- src/runtime/pkg/resourcecontrol/utils_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/pkg/resourcecontrol/utils_linux.go b/src/runtime/pkg/resourcecontrol/utils_linux.go index 59ca788f81..0acbc6c6af 100644 --- a/src/runtime/pkg/resourcecontrol/utils_linux.go +++ b/src/runtime/pkg/resourcecontrol/utils_linux.go @@ -156,7 +156,7 @@ func IsCgroupV1() (bool, error) { func SetThreadAffinity(threadID int, cpuSetSlice []int) error { unixCPUSet := unix.CPUSet{} - for cpuId := range cpuSetSlice { + for _, cpuId := range cpuSetSlice { unixCPUSet.Set(cpuId) }