aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mgcmark.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/mgcmark.go')
-rw-r--r--src/runtime/mgcmark.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go
index 00b96fd00b..aa7f7a7769 100644
--- a/src/runtime/mgcmark.go
+++ b/src/runtime/mgcmark.go
@@ -393,10 +393,15 @@ func gcAssistAlloc(gp *g) {
}
// Compute the amount of scan work we need to do to make the
- // balance positive. We over-assist to build up credit for
- // future allocations and amortize the cost of assisting.
- debtBytes := -gp.gcAssistBytes + gcOverAssistBytes
+ // balance positive. When the required amount of work is low,
+ // we over-assist to build up credit for future allocations
+ // and amortize the cost of assisting.
+ debtBytes := -gp.gcAssistBytes
scanWork := int64(gcController.assistWorkPerByte * float64(debtBytes))
+ if scanWork < gcOverAssistWork {
+ scanWork = gcOverAssistWork
+ debtBytes = int64(gcController.assistBytesPerWork * float64(scanWork))
+ }
retry:
// Steal as much credit as we can from the background GC's