runtime: dynamically allocate allp

This makes it possible to eliminate the hard cap on GOMAXPROCS.

Updates #15131.

Change-Id: I4c422b340791621584c118a6be1b38e8a44f8b70
Reviewed-on: https://go-review.googlesource.com/45573
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
Austin Clements 2017-06-13 11:32:17 -04:00
parent 197f9ba11d
commit 84d2c7ea83
6 changed files with 47 additions and 9 deletions

View file

@ -722,7 +722,8 @@ const _TracebackMaxFrames = 100
var (
allglen uintptr
allm *m
allp [_MaxGomaxprocs + 1]*p
allp []*p // len(allp) == gomaxprocs; may change at safe points, otherwise immutable
allpLock mutex // Protects P-less reads of allp and all writes
gomaxprocs int32
ncpu int32
forcegc forcegcstate