Most of the uses of work.pauseStart are completely useless, it could
simply be a local variable. One use passes a parameter from gcMarkDone
to gcMarkTermination, but that could simply be an argument.
Keeping this field in workType makes it seems more important than it
really is, so just drop it.
Change-Id: I2fdc0b21f8844e5e7be47148c3e10f13e49815c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/542075
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
tSweepTerm, tMark, tMarkTerm, tEnd int64 // nanotime() of phase start
pauseNS int64 // total STW time this cycle
tSweepTerm, tMark, tMarkTerm, tEnd int64 // nanotime() of phase start
pauseNS int64 // total STW time this cycle
- pauseStart int64 // nanotime() of last STW
// debug.gctrace heap sizes for this cycle.
heap0, heap1, heap2 uint64
// debug.gctrace heap sizes for this cycle.
heap0, heap1, heap2 uint64
now := nanotime()
work.tSweepTerm = now
now := nanotime()
work.tSweepTerm = now
systemstack(func() { stopTheWorldWithSema(stwGCSweepTerm) })
// Finish sweep before we start concurrent scan.
systemstack(func() {
systemstack(func() { stopTheWorldWithSema(stwGCSweepTerm) })
// Finish sweep before we start concurrent scan.
systemstack(func() {
// Concurrent mark.
systemstack(func() {
now = startTheWorldWithSema()
// Concurrent mark.
systemstack(func() {
now = startTheWorldWithSema()
- work.pauseNS += now - work.pauseStart
+ work.pauseNS += now - pauseStart
- memstats.gcPauseDist.record(now - work.pauseStart)
+ memstats.gcPauseDist.record(now - pauseStart)
sweepTermCpu := int64(work.stwprocs) * (work.tMark - work.tSweepTerm)
work.cpuStats.gcPauseTime += sweepTermCpu
sweepTermCpu := int64(work.stwprocs) * (work.tMark - work.tSweepTerm)
work.cpuStats.gcPauseTime += sweepTermCpu
// shaded. Transition to mark termination.
now := nanotime()
work.tMarkTerm = now
// shaded. Transition to mark termination.
now := nanotime()
work.tMarkTerm = now
getg().m.preemptoff = "gcing"
systemstack(func() { stopTheWorldWithSema(stwGCMarkTerm) })
// The gcphase is _GCmark, it will transition to _GCmarktermination
getg().m.preemptoff = "gcing"
systemstack(func() { stopTheWorldWithSema(stwGCMarkTerm) })
// The gcphase is _GCmark, it will transition to _GCmarktermination
getg().m.preemptoff = ""
systemstack(func() {
now := startTheWorldWithSema()
getg().m.preemptoff = ""
systemstack(func() {
now := startTheWorldWithSema()
- work.pauseNS += now - work.pauseStart
- memstats.gcPauseDist.record(now - work.pauseStart)
+ work.pauseNS += now - pauseStart
+ memstats.gcPauseDist.record(now - pauseStart)
})
semrelease(&worldsema)
goto top
})
semrelease(&worldsema)
goto top
gcController.endCycle(now, int(gomaxprocs), work.userForced)
// Perform mark termination. This will restart the world.
gcController.endCycle(now, int(gomaxprocs), work.userForced)
// Perform mark termination. This will restart the world.
+ gcMarkTermination(pauseStart)
}
// World must be stopped and mark assists and background workers must be
// disabled.
}
// World must be stopped and mark assists and background workers must be
// disabled.
-func gcMarkTermination() {
+func gcMarkTermination(pauseStart int64) {
// Start marktermination (write barrier remains enabled for now).
setGCPhase(_GCmarktermination)
// Start marktermination (write barrier remains enabled for now).
setGCPhase(_GCmarktermination)
now := nanotime()
sec, nsec, _ := time_now()
unixNow := sec*1e9 + int64(nsec)
now := nanotime()
sec, nsec, _ := time_now()
unixNow := sec*1e9 + int64(nsec)
- work.pauseNS += now - work.pauseStart
+ work.pauseNS += now - pauseStart
- memstats.gcPauseDist.record(now - work.pauseStart)
+ memstats.gcPauseDist.record(now - pauseStart)
atomic.Store64(&memstats.last_gc_unix, uint64(unixNow)) // must be Unix time to make sense to user
atomic.Store64(&memstats.last_gc_nanotime, uint64(now)) // monotonic time for us
memstats.pause_ns[memstats.numgc%uint32(len(memstats.pause_ns))] = uint64(work.pauseNS)
atomic.Store64(&memstats.last_gc_unix, uint64(unixNow)) // must be Unix time to make sense to user
atomic.Store64(&memstats.last_gc_nanotime, uint64(now)) // monotonic time for us
memstats.pause_ns[memstats.numgc%uint32(len(memstats.pause_ns))] = uint64(work.pauseNS)