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 <rye@stripe.com>
This commit is contained in:
Peteris Rudzusiks
2023-05-15 16:03:33 +02:00
committed by Fabiano Fidêncio
parent 4ec5db0fb3
commit d37c6e370d

View File

@@ -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)
}