You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
x/sys: SchedGetaffinity fails on Linux machines with enough (potential) CPUs #23639
The second argument here is the number of bytes in the cpuset. Eight bytes is not very many and looking at how unix.CPUSet is defined in the source code suggests that there is supposed to be room for 1024 CPUs. However, inspection of the actual code making the system call in affinity_linux.go suggests that it is making a size of pointer versus size of object pointed to confusion. The set argument is a pointer to a CPUSet not a CPUSet, so unsafe.Sizeof(set) is the size of the pointer (8 bytes on a 64-bit machine) instead of the much larger size of the CPUSet.
Activity
ianlancetaylor commentedon Jan 31, 2018
CC @tklauser
gopherbot commentedon Feb 1, 2018
Change https://golang.org/cl/91375 mentions this issue:
unix: fix cpuset size argument in sched_affinity syscalltklauser commentedon Feb 1, 2018
@siebenmann Thanks for the detailed report an analysis. I sent golang.org/cl/91375 with a fix. Care to give it a try?
siebenmann commentedon Feb 1, 2018
I can confirm that this change/fix fixes the issue for me.
unix: fix cpuset size argument in sched_affinity syscall