For #53821.
Change-Id: Ic54bda422b87ee9365090fe6b42b82df7b25d2a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/417782
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
unsafe.Offsetof(schedt{}.pollUntil),
unsafe.Offsetof(schedt{}.timeToRun),
unsafe.Offsetof(gcControllerState{}.dedicatedMarkWorkersNeeded),
- unsafe.Offsetof(gcControllerState{}.fractionalMarkTime),
unsafe.Offsetof(gcControllerState{}.idleMarkTime),
unsafe.Offsetof(timeHistogram{}.underflow),
unsafe.Offsetof(profBuf{}.overflow),
sweepTermCpu := int64(work.stwprocs) * (work.tMark - work.tSweepTerm)
// We report idle marking time below, but omit it from the
// overall utilization here since it's "free".
- markCpu := gcController.assistTime.Load() + gcController.dedicatedMarkTime.Load() + gcController.fractionalMarkTime
+ markCpu := gcController.assistTime.Load() + gcController.dedicatedMarkTime.Load() + gcController.fractionalMarkTime.Load()
markTermCpu := int64(work.stwprocs) * (work.tEnd - work.tMarkTerm)
cycleCpu := sweepTermCpu + markCpu + markTermCpu
work.totaltime += cycleCpu
for i, ns := range []int64{
sweepTermCpu,
gcController.assistTime.Load(),
- gcController.dedicatedMarkTime.Load() + gcController.fractionalMarkTime,
+ gcController.dedicatedMarkTime.Load() + gcController.fractionalMarkTime.Load(),
gcController.idleMarkTime,
markTermCpu,
} {
// phase.
dedicatedMarkTime atomic.Int64
- // fractionalMarkTime is the nanoseconds spent in the
- // fractional mark worker during this cycle. This is updated
- // atomically throughout the cycle and will be up-to-date if
- // the fractional mark worker is not currently running.
- fractionalMarkTime int64
+ // fractionalMarkTime is the nanoseconds spent in the fractional mark
+ // worker during this cycle. This is updated throughout the cycle and
+ // will be up-to-date if the fractional mark worker is not currently
+ // running.
+ fractionalMarkTime atomic.Int64
// idleMarkTime is the nanoseconds spent in idle marking
// during this cycle. This is updated atomically throughout
c.bgScanCredit.Store(0)
c.assistTime.Store(0)
c.dedicatedMarkTime.Store(0)
- c.fractionalMarkTime = 0
+ c.fractionalMarkTime.Store(0)
c.idleMarkTime = 0
c.markStartTime = markStartTime
c.dedicatedMarkTime.Add(duration)
atomic.Xaddint64(&c.dedicatedMarkWorkersNeeded, 1)
case gcMarkWorkerFractionalMode:
- atomic.Xaddint64(&c.fractionalMarkTime, duration)
+ c.fractionalMarkTime.Add(duration)
case gcMarkWorkerIdleMode:
atomic.Xaddint64(&c.idleMarkTime, duration)
c.removeIdleMarkWorker()