]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: eliminate GOMAXPROCS limit
authorAustin Clements <austin@google.com>
Tue, 13 Jun 2017 15:33:57 +0000 (11:33 -0400)
committerAustin Clements <austin@google.com>
Wed, 27 Sep 2017 16:29:12 +0000 (16:29 +0000)
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>
src/runtime/debug.go
src/runtime/proc.go
src/runtime/runtime2.go

index 0e798fc6f5a0c7e15e7b1b24fb0ab8c5f1fd029c..feacfb60264d745c3dc8da81e5861eec5c3fb1ab 100644 (file)
@@ -15,9 +15,6 @@ import (
 // The number of logical CPUs on the local machine can be queried with NumCPU.
 // This call will go away when the scheduler improves.
 func GOMAXPROCS(n int) int {
-       if n > _MaxGomaxprocs {
-               n = _MaxGomaxprocs
-       }
        lock(&sched.lock)
        ret := int(gomaxprocs)
        unlock(&sched.lock)
index 188c897723498a200723e717b1b2ddb61048cb13..81652288fb28f1e2a3cb8206089ac2fb3d3a3112 100644 (file)
@@ -495,9 +495,6 @@ func schedinit() {
        if n, ok := atoi32(gogetenv("GOMAXPROCS")); ok && n > 0 {
                procs = n
        }
-       if procs > _MaxGomaxprocs {
-               procs = _MaxGomaxprocs
-       }
        if procresize(procs) != nil {
                throw("unknown runnable goroutine during bootstrap")
        }
@@ -3529,7 +3526,7 @@ func setcpuprofilerate(hz int32) {
 // Returns list of Ps with local work, they need to be scheduled by the caller.
 func procresize(nprocs int32) *p {
        old := gomaxprocs
-       if old < 0 || old > _MaxGomaxprocs || nprocs <= 0 || nprocs > _MaxGomaxprocs {
+       if old < 0 || nprocs <= 0 {
                throw("procresize: invalid arg")
        }
        if trace.enabled {
index 269c5b1c4d39e3ac5f8c506245d50a3bd78c8038..055fff18af52b006a134df5d498f0b252a62cddc 100644 (file)
@@ -520,12 +520,6 @@ type p struct {
        pad [sys.CacheLineSize]byte
 }
 
-const (
-       // The max value of GOMAXPROCS.
-       // There are no fundamental restrictions on the value.
-       _MaxGomaxprocs = 1 << 10
-)
-
 type schedt struct {
        // accessed atomically. keep at top to ensure alignment on 32-bit systems.
        goidgen  uint64