runtime: convert gcController.heapScan to atomic type

For #53821.

Change-Id: I64d3f53c89a579d93056906304e4c05fc35cd9b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/417776
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:
Michael Pratt 2022-07-15 16:56:03 -04:00
parent 3a9281ff61
commit 6e9925c4f7
3 changed files with 12 additions and 14 deletions

View file

@ -1325,7 +1325,7 @@ func (c *GCController) StartCycle(stackSize, globalsSize uint64, scannableFrac f
c.maxStackScan = stackSize
c.globalsScan = globalsSize
c.heapLive.Store(trigger)
c.heapScan += uint64(float64(trigger-c.heapMarked) * scannableFrac)
c.heapScan.Add(int64(float64(trigger-c.heapMarked) * scannableFrac))
c.startCycle(0, gomaxprocs, gcTrigger{kind: gcTriggerHeap})
}
@ -1359,7 +1359,7 @@ type GCControllerReviseDelta struct {
func (c *GCController) Revise(d GCControllerReviseDelta) {
c.heapLive.Add(d.HeapLive)
c.heapScan += uint64(d.HeapScan)
c.heapScan.Add(d.HeapScan)
c.heapScanWork.Add(d.HeapScanWork)
c.stackScanWork.Add(d.StackScanWork)
c.globalsScanWork.Add(d.GlobalsScanWork)