]> Cypherpunks repositories - gostls13.git/commit
runtime: define and enforce synchronization on heap_scan
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 23 Jul 2020 20:13:49 +0000 (20:13 +0000)
committerMichael Knyszek <mknyszek@google.com>
Mon, 26 Oct 2020 17:25:40 +0000 (17:25 +0000)
commit8cc280aa727bc7159adfdd083861472aa3066a35
tree9c46bf629d0c99d6fb96be9bb1be74e72edea588
parenta8e2966eb01f175c330f6669f838e83af2cb73e3
runtime: define and enforce synchronization on heap_scan

Currently heap_scan is mostly protected by the heap lock, but
gcControllerState.revise sometimes accesses it without a lock. In an
effort to make gcControllerState.revise callable from more contexts (and
have its synchronization guarantees actually respected), make heap_scan
atomically read from and written to, unless the world is stopped.

Note that we don't update gcControllerState.revise's erroneous doc
comment here because this change isn't about revise's guarantees, just
about heap_scan. The comment is updated in a later change.

Change-Id: Iddbbeb954767c704c2bd1d221f36e6c4fc9948a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/246960
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/mgc.go
src/runtime/mheap.go
src/runtime/mstats.go