mirror of
https://github.com/golang/go
synced 2024-11-17 22:54:48 -07:00
runtime: reset sweep stats before starting the world
Currently we reset the sweep stats just after gcMarkTermination starts the world and releases worldsema. However, background sweeping can start the moment we start the world and, in fact, pause sweeping can start the moment we release worldsema (because another GC cycle can start up), so these need to be cleared before starting the world. Change-Id: I95701e3de6af76bb3fbf2ee65719985bf57d20b2 Reviewed-on: https://go-review.googlesource.com/17811 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
87d939dee8
commit
ff5c945382
@ -1245,6 +1245,10 @@ func gcMarkTermination() {
|
|||||||
|
|
||||||
memstats.numgc++
|
memstats.numgc++
|
||||||
|
|
||||||
|
// Reset sweep state.
|
||||||
|
sweep.nbgsweep = 0
|
||||||
|
sweep.npausesweep = 0
|
||||||
|
|
||||||
systemstack(startTheWorldWithSema)
|
systemstack(startTheWorldWithSema)
|
||||||
|
|
||||||
// Free stack spans. This must be done between GC cycles.
|
// Free stack spans. This must be done between GC cycles.
|
||||||
@ -1301,8 +1305,6 @@ func gcMarkTermination() {
|
|||||||
print("\n")
|
print("\n")
|
||||||
printunlock()
|
printunlock()
|
||||||
}
|
}
|
||||||
sweep.nbgsweep = 0
|
|
||||||
sweep.npausesweep = 0
|
|
||||||
|
|
||||||
// now that gc is done, kick off finalizer thread if needed
|
// now that gc is done, kick off finalizer thread if needed
|
||||||
if !concurrentSweep {
|
if !concurrentSweep {
|
||||||
|
Loading…
Reference in New Issue
Block a user