Commit ee55000f authored by Austin Clements's avatar Austin Clements

runtime: eliminate GOMAXPROCS limit

Now that allp is dynamically allocated, there's no need for a hard cap
on GOMAXPROCS.

Fixes #15131.

Change-Id: I53eee8e228a711a818f7ebce8d9fd915b3865eed
Reviewed-on: https://go-review.googlesource.com/45574
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarRick Hudson <rlh@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 84d2c7ea
...@@ -15,9 +15,6 @@ import ( ...@@ -15,9 +15,6 @@ import (
// The number of logical CPUs on the local machine can be queried with NumCPU. // The number of logical CPUs on the local machine can be queried with NumCPU.
// This call will go away when the scheduler improves. // This call will go away when the scheduler improves.
func GOMAXPROCS(n int) int { func GOMAXPROCS(n int) int {
if n > _MaxGomaxprocs {
n = _MaxGomaxprocs
}
lock(&sched.lock) lock(&sched.lock)
ret := int(gomaxprocs) ret := int(gomaxprocs)
unlock(&sched.lock) unlock(&sched.lock)
......
...@@ -495,9 +495,6 @@ func schedinit() { ...@@ -495,9 +495,6 @@ func schedinit() {
if n, ok := atoi32(gogetenv("GOMAXPROCS")); ok && n > 0 { if n, ok := atoi32(gogetenv("GOMAXPROCS")); ok && n > 0 {
procs = n procs = n
} }
if procs > _MaxGomaxprocs {
procs = _MaxGomaxprocs
}
if procresize(procs) != nil { if procresize(procs) != nil {
throw("unknown runnable goroutine during bootstrap") throw("unknown runnable goroutine during bootstrap")
} }
...@@ -3529,7 +3526,7 @@ func setcpuprofilerate(hz int32) { ...@@ -3529,7 +3526,7 @@ func setcpuprofilerate(hz int32) {
// Returns list of Ps with local work, they need to be scheduled by the caller. // Returns list of Ps with local work, they need to be scheduled by the caller.
func procresize(nprocs int32) *p { func procresize(nprocs int32) *p {
old := gomaxprocs old := gomaxprocs
if old < 0 || old > _MaxGomaxprocs || nprocs <= 0 || nprocs > _MaxGomaxprocs { if old < 0 || nprocs <= 0 {
throw("procresize: invalid arg") throw("procresize: invalid arg")
} }
if trace.enabled { if trace.enabled {
......
...@@ -520,12 +520,6 @@ type p struct { ...@@ -520,12 +520,6 @@ type p struct {
pad [sys.CacheLineSize]byte pad [sys.CacheLineSize]byte
} }
const (
// The max value of GOMAXPROCS.
// There are no fundamental restrictions on the value.
_MaxGomaxprocs = 1 << 10
)
type schedt struct { type schedt struct {
// accessed atomically. keep at top to ensure alignment on 32-bit systems. // accessed atomically. keep at top to ensure alignment on 32-bit systems.
goidgen uint64 goidgen uint64
......
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