mirror of
https://github.com/golang/go
synced 2024-11-12 03:00:22 -07:00
gc: limit helper threads based on ncpu
When ncpu < 2, work.nproc is always 1 which results in infinite helper threads being created if gomaxprocs > 1 and MaxGcproc > 1. Avoid this by using the same limits as imposed helpgc(). R=golang-dev, rsc, dvyukov CC=golang-dev https://golang.org/cl/5176044
This commit is contained in:
parent
528ccdc513
commit
a5f064a3e1
@ -984,8 +984,7 @@ runtime·gc(int32 force)
|
|||||||
// coordinate. This lazy approach works out in practice:
|
// coordinate. This lazy approach works out in practice:
|
||||||
// we don't mind if the first couple gc rounds don't have quite
|
// we don't mind if the first couple gc rounds don't have quite
|
||||||
// the maximum number of procs.
|
// the maximum number of procs.
|
||||||
extra = work.nproc < runtime·gomaxprocs && work.nproc < MaxGcproc;
|
extra = work.nproc < runtime·gomaxprocs && work.nproc < runtime·ncpu && work.nproc < MaxGcproc;
|
||||||
|
|
||||||
runtime·starttheworld(extra);
|
runtime·starttheworld(extra);
|
||||||
|
|
||||||
// give the queued finalizers, if any, a chance to run
|
// give the queued finalizers, if any, a chance to run
|
||||||
|
Loading…
Reference in New Issue
Block a user