Go version
go version go1.25.0 (Red Hat 1.25.0-4.el10) linux/amd64 (from CentOS Stream 10)
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v3'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2000012266=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/golang'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/lib/golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25.0 (Red Hat 1.25.0-4.el10)'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
import (
"fmt"
"os"
"golang.org/x/sys/unix"
)
func main() {
var cpuset unix.CPUSet
err := unix.SchedGetaffinity(0, &cpuset)
if err != nil {
fmt.Printf("SchedGetaffinity: %v\n", err)
os.Exit(1)
}
fmt.Printf("%d\n", cpuset.Count())
}
What did you see happen?
$ go run .
SchedGetaffinity: invalid argument
exit status 1
$ strace -f ./main
sched_getaffinity(0, 128, 0xc001386ea0) = -1 EINVAL (Invalid argument)
Here, we see a Golang called sched_getaffinity with a bitmask large enough for only 1024 threads; 8192 is the universally accepted limit and what libnuma and related uses.
What did you expect to see?
1920
I'm running on a 16-socket system with 1920 hardware threads.
Go version
go version go1.25.0 (Red Hat 1.25.0-4.el10) linux/amd64 (from CentOS Stream 10)
Output of
go envin your module/workspace:What did you do?
What did you see happen?
Here, we see a Golang called sched_getaffinity with a bitmask large enough for only 1024 threads; 8192 is the universally accepted limit and what libnuma and related uses.
What did you expect to see?
1920I'm running on a 16-socket system with 1920 hardware threads.