Use hw.ncpuonline rather than hw.ncpu to determine how many threads to run.

Prompted by tedu@
This commit is contained in:
jsing 2019-02-09 15:09:19 +00:00
parent 9b01b775c9
commit a3bbf060d3
2 changed files with 31 additions and 2 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.58 2019/01/29 14:25:28 jsing Exp $
# $OpenBSD: Makefile,v 1.59 2019/02/09 15:09:19 jsing Exp $
ONLY_FOR_ARCHS = ${GO_ARCHS}
COMMENT = Go programming language
VERSION = 1.11.5
REVISION = 0
REVISION = 1
EXTRACT_SUFX = .src.tar.gz
DISTNAME = go${VERSION}
PKGNAME = go-${VERSION}

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-src_runtime_os_openbsd_go,v 1.3 2019/02/09 15:09:19 jsing Exp $
Index: src/runtime/os_openbsd.go
--- src/runtime/os_openbsd.go.orig
+++ src/runtime/os_openbsd.go
@@ -84,9 +84,9 @@ const (
_CTL_KERN = 1
_KERN_OSREV = 3
- _CTL_HW = 6
- _HW_NCPU = 3
- _HW_PAGESIZE = 7
+ _CTL_HW = 6
+ _HW_PAGESIZE = 7
+ _HW_NCPUONLINE = 25
)
func sysctlInt(mib []uint32) (int32, bool) {
@@ -100,8 +100,8 @@ func sysctlInt(mib []uint32) (int32, bool) {
}
func getncpu() int32 {
- // Fetch hw.ncpu via sysctl.
- if ncpu, ok := sysctlInt([]uint32{_CTL_HW, _HW_NCPU}); ok {
+ // Fetch hw.ncpuonline via sysctl.
+ if ncpu, ok := sysctlInt([]uint32{_CTL_HW, _HW_NCPUONLINE}); ok {
return int32(ncpu)
}
return 1