]> Cypherpunks repositories - gostls13.git/commit
runtime: access the assist ratio atomically
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 23 Jul 2020 20:48:06 +0000 (20:48 +0000)
committerMichael Knyszek <mknyszek@google.com>
Mon, 26 Oct 2020 17:26:01 +0000 (17:26 +0000)
commitce46f197b6c75281b77ee93338e2559671e28b01
tree59d8eacdc2fc7dab3b04a724f4e2e32cb223f9c2
parentf5c6875f3228951afa1fcf2ec01c614e0fb7e2dd
runtime: access the assist ratio atomically

This change makes it so that the GC assist ratio (the pair of
gcControllerState fields assistBytesPerWork and assistWorkPerByte) is
updated atomically. Note that the pair of fields are not updated
together atomically, but that's OK. The code here was already racy for
some time and in practice the assist ratio moves very slowly.

The purpose of this change is so that we can document
gcController.revise to be safe for concurrent use, which will be useful
in further changes.

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