]> Cypherpunks repositories - gostls13.git/commit
runtime: encapsulate access to allgs
authorMichael Pratt <mpratt@google.com>
Wed, 23 Dec 2020 20:05:37 +0000 (15:05 -0500)
committerMichael Pratt <mpratt@google.com>
Fri, 5 Mar 2021 22:09:52 +0000 (22:09 +0000)
commitd85083911d6ea742901933a544467dad55bb381f
treef8f826d01c3ff45af5908c8a1d71befe4439f97c
parent39bdd41d03725878f1fd6f8b500ba6700f03bdad
runtime: encapsulate access to allgs

Correctly accessing allgs is a bit hairy. Some paths need to lock
allglock, some don't. Those that don't are safest using atomicAllG, but
usage is not consistent.

Rather than doing this ad-hoc, move all access* through forEachG /
forEachGRace, the locking and atomic versions, respectively. This will
make it easier to ensure safe access.

* markroot is the only exception, as it has a far-removed guarantee of
safe access via an atomic load of allglen far before actual use.

Change-Id: Ie1c7a8243e155ae2b4bc3143577380c695680e89
Reviewed-on: https://go-review.googlesource.com/c/go/+/279994
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/runtime/heapdump.go
src/runtime/mgc.go
src/runtime/mgcmark.go
src/runtime/mprof.go
src/runtime/proc.go
src/runtime/trace.go
src/runtime/traceback.go