Commit 984753b6 authored by Austin Clements's avatar Austin Clements

runtime: fix GC assist retry path

GC assists retry if preempted or if they fail to park. However, on the
retry path they currently use stale statistics. In particular, the
retry can use "debtBytes", but debtBytes isn't updated when the debt
changes (since other than retries it is only used once). Also, though
less of a problem, the if the assist ratio has changed while the
assist was blocked, the retry will still use the old assist ratio.

Fix all of this by simply making the retry jump back to where we
compute these statistics, rather than just after.

Change-Id: I2ed8b4f0fc9f008ff060aa926f4334b662ac7d3f
Reviewed-on: https://go-review.googlesource.com/30701Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
parent 81c431a5
......@@ -406,6 +406,7 @@ func gcAssistAlloc(gp *g) {
return
}
retry:
// Compute the amount of scan work we need to do to make the
// balance positive. When the required amount of work is low,
// we over-assist to build up credit for future allocations
......@@ -417,7 +418,6 @@ func gcAssistAlloc(gp *g) {
debtBytes = int64(gcController.assistBytesPerWork * float64(scanWork))
}
retry:
// Steal as much credit as we can from the background GC's
// scan credit. This is racy and may drop the background
// credit below 0 if two mutators steal at the same time. This
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment