mirror of
https://github.com/golang/go
synced 2024-09-30 04:14:29 -06:00
runtime: convert gcController.idleMarkTime to atomic type
For #53821. Change-Id: I2f2b462908096dacb97fba9973798036ea1d9b68 Reviewed-on: https://go-review.googlesource.com/c/go/+/417783 Run-TryBot: Michael Pratt <mpratt@google.com> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
fe406c8b11
commit
dcd10375bc
@ -22,7 +22,6 @@ var AtomicFields = []uintptr{
|
||||
unsafe.Offsetof(schedt{}.pollUntil),
|
||||
unsafe.Offsetof(schedt{}.timeToRun),
|
||||
unsafe.Offsetof(gcControllerState{}.dedicatedMarkWorkersNeeded),
|
||||
unsafe.Offsetof(gcControllerState{}.idleMarkTime),
|
||||
unsafe.Offsetof(timeHistogram{}.underflow),
|
||||
unsafe.Offsetof(profBuf{}.overflow),
|
||||
unsafe.Offsetof(profBuf{}.overflowTime),
|
||||
|
@ -1106,7 +1106,7 @@ func gcMarkTermination() {
|
||||
sweepTermCpu,
|
||||
gcController.assistTime.Load(),
|
||||
gcController.dedicatedMarkTime.Load() + gcController.fractionalMarkTime.Load(),
|
||||
gcController.idleMarkTime,
|
||||
gcController.idleMarkTime.Load(),
|
||||
markTermCpu,
|
||||
} {
|
||||
if i == 2 || i == 3 {
|
||||
|
@ -281,10 +281,9 @@ type gcControllerState struct {
|
||||
// running.
|
||||
fractionalMarkTime atomic.Int64
|
||||
|
||||
// idleMarkTime is the nanoseconds spent in idle marking
|
||||
// during this cycle. This is updated atomically throughout
|
||||
// the cycle.
|
||||
idleMarkTime int64
|
||||
// idleMarkTime is the nanoseconds spent in idle marking during this
|
||||
// cycle. This is updated throughout the cycle.
|
||||
idleMarkTime atomic.Int64
|
||||
|
||||
// markStartTime is the absolute start time in nanoseconds
|
||||
// that assists and background mark workers started.
|
||||
@ -420,7 +419,7 @@ func (c *gcControllerState) startCycle(markStartTime int64, procs int, trigger g
|
||||
c.assistTime.Store(0)
|
||||
c.dedicatedMarkTime.Store(0)
|
||||
c.fractionalMarkTime.Store(0)
|
||||
c.idleMarkTime = 0
|
||||
c.idleMarkTime.Store(0)
|
||||
c.markStartTime = markStartTime
|
||||
|
||||
// TODO(mknyszek): This is supposed to be the actual trigger point for the heap, but
|
||||
@ -671,7 +670,7 @@ func (c *gcControllerState) endCycle(now int64, procs int, userForced bool) {
|
||||
}
|
||||
idleUtilization := 0.0
|
||||
if assistDuration > 0 {
|
||||
idleUtilization = float64(c.idleMarkTime) / float64(assistDuration*int64(procs))
|
||||
idleUtilization = float64(c.idleMarkTime.Load()) / float64(assistDuration*int64(procs))
|
||||
}
|
||||
// Determine the cons/mark ratio.
|
||||
//
|
||||
@ -910,7 +909,7 @@ func (c *gcControllerState) markWorkerStop(mode gcMarkWorkerMode, duration int64
|
||||
case gcMarkWorkerFractionalMode:
|
||||
c.fractionalMarkTime.Add(duration)
|
||||
case gcMarkWorkerIdleMode:
|
||||
atomic.Xaddint64(&c.idleMarkTime, duration)
|
||||
c.idleMarkTime.Add(duration)
|
||||
c.removeIdleMarkWorker()
|
||||
default:
|
||||
throw("markWorkerStop: unknown mark worker mode")
|
||||
|
Loading…
Reference in New Issue
Block a user