Commit 5fdefe91 authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle Committed by Andrew Gerrand

runtime: clamp OS-reported number of processors to _MaxGomaxprocs

So that all Go processes do not die on startup on a system with >256 CPUs.

I tested this by hacking osinit to set ncpu to 1000.

Updates #15131
Fixes #15160

Change-Id: I52e061a0de97be41d684dd8b748fa9087d6f1aef
Reviewed-on: https://go-review.googlesource.com/21599Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/22206
parent 6fd563d3
......@@ -443,6 +443,9 @@ func schedinit() {
sched.lastpoll = uint64(nanotime())
procs := int(ncpu)
if procs > _MaxGomaxprocs {
procs = _MaxGomaxprocs
}
if n := atoi(gogetenv("GOMAXPROCS")); n > 0 {
if n > _MaxGomaxprocs {
n = _MaxGomaxprocs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment