Commit 4b2774f5 authored by Austin Clements's avatar Austin Clements

runtime: make sysmon-triggered GC concurrent

sysmon triggers a GC if there has been no GC for two minutes.
Currently, this is a STW GC. There is no reason for this to be STW, so
make it concurrent.

Fixes #10261.

Change-Id: I92f3ac37272d5c2a31480ff1fa897ebad08775a9
Reviewed-on: https://go-review.googlesource.com/11955Reviewed-by: 's avatarRob Pike <r@golang.org>
Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
parent 012917af
......@@ -154,7 +154,7 @@ func forcegchelper() {
if debug.gctrace > 0 {
println("GC forced")
}
startGC(gcForceMode)
startGC(gcBackgroundMode)
}
}
......
......@@ -3004,7 +3004,7 @@ func sysmon() {
}
// check if we need to force a GC
lastgc := int64(atomicload64(&memstats.last_gc))
if lastgc != 0 && unixnow-lastgc > forcegcperiod && atomicload(&forcegc.idle) != 0 {
if lastgc != 0 && unixnow-lastgc > forcegcperiod && atomicload(&forcegc.idle) != 0 && atomicloaduint(&bggc.working) == 0 {
lock(&forcegc.lock)
forcegc.idle = 0
forcegc.g.schedlink = 0
......
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