Skip to content

Commit ee55000

Browse files
committed
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: Rick Hudson <rlh@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
1 parent 84d2c7e commit ee55000

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

src/runtime/debug.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import (
1515
// The number of logical CPUs on the local machine can be queried with NumCPU.
1616
// This call will go away when the scheduler improves.
1717
func GOMAXPROCS(n int) int {
18-
if n > _MaxGomaxprocs {
19-
n = _MaxGomaxprocs
20-
}
2118
lock(&sched.lock)
2219
ret := int(gomaxprocs)
2320
unlock(&sched.lock)

src/runtime/proc.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,6 @@ func schedinit() {
495495
if n, ok := atoi32(gogetenv("GOMAXPROCS")); ok && n > 0 {
496496
procs = n
497497
}
498-
if procs > _MaxGomaxprocs {
499-
procs = _MaxGomaxprocs
500-
}
501498
if procresize(procs) != nil {
502499
throw("unknown runnable goroutine during bootstrap")
503500
}
@@ -3529,7 +3526,7 @@ func setcpuprofilerate(hz int32) {
35293526
// Returns list of Ps with local work, they need to be scheduled by the caller.
35303527
func procresize(nprocs int32) *p {
35313528
old := gomaxprocs
3532-
if old < 0 || old > _MaxGomaxprocs || nprocs <= 0 || nprocs > _MaxGomaxprocs {
3529+
if old < 0 || nprocs <= 0 {
35333530
throw("procresize: invalid arg")
35343531
}
35353532
if trace.enabled {

src/runtime/runtime2.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,6 @@ type p struct {
520520
pad [sys.CacheLineSize]byte
521521
}
522522

523-
const (
524-
// The max value of GOMAXPROCS.
525-
// There are no fundamental restrictions on the value.
526-
_MaxGomaxprocs = 1 << 10
527-
)
528-
529523
type schedt struct {
530524
// accessed atomically. keep at top to ensure alignment on 32-bit systems.
531525
goidgen uint64

0 commit comments

Comments
 (0)