Skip to content

Commit

Permalink
resource-control: fix setting CPU affinities on Linux
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rye-stripe committed May 15, 2023
1 parent 9e83795 commit 3e85bf5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/pkg/resourcecontrol/utils_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 3e85bf5

Please sign in to comment.