mirror of
https://github.com/golang/go
synced 2024-09-30 04:34:33 -06:00
runtime: convert gcController.fractionalMarkTime to atomic type
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>
This commit is contained in:
parent
3ea3d0e8a7
commit
fe406c8b11
@ -22,7 +22,6 @@ var AtomicFields = []uintptr{
|
|||||||
unsafe.Offsetof(schedt{}.pollUntil),
|
unsafe.Offsetof(schedt{}.pollUntil),
|
||||||
unsafe.Offsetof(schedt{}.timeToRun),
|
unsafe.Offsetof(schedt{}.timeToRun),
|
||||||
unsafe.Offsetof(gcControllerState{}.dedicatedMarkWorkersNeeded),
|
unsafe.Offsetof(gcControllerState{}.dedicatedMarkWorkersNeeded),
|
||||||
unsafe.Offsetof(gcControllerState{}.fractionalMarkTime),
|
|
||||||
unsafe.Offsetof(gcControllerState{}.idleMarkTime),
|
unsafe.Offsetof(gcControllerState{}.idleMarkTime),
|
||||||
unsafe.Offsetof(timeHistogram{}.underflow),
|
unsafe.Offsetof(timeHistogram{}.underflow),
|
||||||
unsafe.Offsetof(profBuf{}.overflow),
|
unsafe.Offsetof(profBuf{}.overflow),
|
||||||
|
@ -1009,7 +1009,7 @@ func gcMarkTermination() {
|
|||||||
sweepTermCpu := int64(work.stwprocs) * (work.tMark - work.tSweepTerm)
|
sweepTermCpu := int64(work.stwprocs) * (work.tMark - work.tSweepTerm)
|
||||||
// We report idle marking time below, but omit it from the
|
// We report idle marking time below, but omit it from the
|
||||||
// overall utilization here since it's "free".
|
// 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)
|
markTermCpu := int64(work.stwprocs) * (work.tEnd - work.tMarkTerm)
|
||||||
cycleCpu := sweepTermCpu + markCpu + markTermCpu
|
cycleCpu := sweepTermCpu + markCpu + markTermCpu
|
||||||
work.totaltime += cycleCpu
|
work.totaltime += cycleCpu
|
||||||
@ -1105,7 +1105,7 @@ func gcMarkTermination() {
|
|||||||
for i, ns := range []int64{
|
for i, ns := range []int64{
|
||||||
sweepTermCpu,
|
sweepTermCpu,
|
||||||
gcController.assistTime.Load(),
|
gcController.assistTime.Load(),
|
||||||
gcController.dedicatedMarkTime.Load() + gcController.fractionalMarkTime,
|
gcController.dedicatedMarkTime.Load() + gcController.fractionalMarkTime.Load(),
|
||||||
gcController.idleMarkTime,
|
gcController.idleMarkTime,
|
||||||
markTermCpu,
|
markTermCpu,
|
||||||
} {
|
} {
|
||||||
|
@ -275,11 +275,11 @@ type gcControllerState struct {
|
|||||||
// phase.
|
// phase.
|
||||||
dedicatedMarkTime atomic.Int64
|
dedicatedMarkTime atomic.Int64
|
||||||
|
|
||||||
// fractionalMarkTime is the nanoseconds spent in the
|
// fractionalMarkTime is the nanoseconds spent in the fractional mark
|
||||||
// fractional mark worker during this cycle. This is updated
|
// worker during this cycle. This is updated throughout the cycle and
|
||||||
// atomically throughout the cycle and will be up-to-date if
|
// will be up-to-date if the fractional mark worker is not currently
|
||||||
// the fractional mark worker is not currently running.
|
// running.
|
||||||
fractionalMarkTime int64
|
fractionalMarkTime atomic.Int64
|
||||||
|
|
||||||
// idleMarkTime is the nanoseconds spent in idle marking
|
// idleMarkTime is the nanoseconds spent in idle marking
|
||||||
// during this cycle. This is updated atomically throughout
|
// during this cycle. This is updated atomically throughout
|
||||||
@ -419,7 +419,7 @@ func (c *gcControllerState) startCycle(markStartTime int64, procs int, trigger g
|
|||||||
c.bgScanCredit.Store(0)
|
c.bgScanCredit.Store(0)
|
||||||
c.assistTime.Store(0)
|
c.assistTime.Store(0)
|
||||||
c.dedicatedMarkTime.Store(0)
|
c.dedicatedMarkTime.Store(0)
|
||||||
c.fractionalMarkTime = 0
|
c.fractionalMarkTime.Store(0)
|
||||||
c.idleMarkTime = 0
|
c.idleMarkTime = 0
|
||||||
c.markStartTime = markStartTime
|
c.markStartTime = markStartTime
|
||||||
|
|
||||||
@ -908,7 +908,7 @@ func (c *gcControllerState) markWorkerStop(mode gcMarkWorkerMode, duration int64
|
|||||||
c.dedicatedMarkTime.Add(duration)
|
c.dedicatedMarkTime.Add(duration)
|
||||||
atomic.Xaddint64(&c.dedicatedMarkWorkersNeeded, 1)
|
atomic.Xaddint64(&c.dedicatedMarkWorkersNeeded, 1)
|
||||||
case gcMarkWorkerFractionalMode:
|
case gcMarkWorkerFractionalMode:
|
||||||
atomic.Xaddint64(&c.fractionalMarkTime, duration)
|
c.fractionalMarkTime.Add(duration)
|
||||||
case gcMarkWorkerIdleMode:
|
case gcMarkWorkerIdleMode:
|
||||||
atomic.Xaddint64(&c.idleMarkTime, duration)
|
atomic.Xaddint64(&c.idleMarkTime, duration)
|
||||||
c.removeIdleMarkWorker()
|
c.removeIdleMarkWorker()
|
||||||
|
Loading…
Reference in New Issue
Block a user