On Fri, Feb 08, 2019 at 12:10:02AM -0500, Ted Unangst wrote: > Go tries to use NCPU cpus. Unfortunately, half of them are turned off because > hw.smt=0 by default, and then go spends a lot of time fighting against itself. > > The diff below, against go/src/runtime, changes to use the number of CPUs > online. It's possible for this number to change, and thus become stale, but > that's unlikely, and not the default. > > (This sysctl was added in 6.4.) > > --- os_openbsd.go.orig Fri Feb 8 00:02:27 2019 > +++ os_openbsd.go Fri Feb 8 00:06:21 2019 > @@ -85,8 +85,8 @@ > _KERN_OSREV = 3 > > _CTL_HW = 6 > - _HW_NCPU = 3 > _HW_PAGESIZE = 7 > + _HW_NCPUONLINE = 25 > ) > > func sysctlInt(mib []uint32) (int32, bool) { > @@ -101,7 +101,7 @@ > > func getncpu() int32 { > // Fetch hw.ncpu via sysctl. > - if ncpu, ok := sysctlInt([]uint32{_CTL_HW, _HW_NCPU}); ok { > + if ncpu, ok := sysctlInt([]uint32{_CTL_HW, _HW_NCPUONLINE}); ok { > return int32(ncpu) > } > return 1
Is there at least a knob to turn that off entirely ? Like, specifically, when you are bulk-building ports, you do not want go to hog on every cpu while it's not alone. Parallelizing everything is not always (very often not actually) a win.