aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/runtime/mgcmark.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/runtime/mgcmark.go b/src/runtime/mgcmark.go
index dbca5cd1c7..9029d19d43 100644
--- a/src/runtime/mgcmark.go
+++ b/src/runtime/mgcmark.go
@@ -415,10 +415,7 @@ func gcAssistAlloc(gp *g) {
return
}
- if trace.enabled {
- traceGCMarkAssistStart()
- }
-
+ traced := false
retry:
// Compute the amount of scan work we need to do to make the
// balance positive. When the required amount of work is low,
@@ -454,13 +451,18 @@ retry:
if scanWork == 0 {
// We were able to steal all of the credit we
// needed.
- if trace.enabled {
+ if traced {
traceGCMarkAssistDone()
}
return
}
}
+ if trace.enabled && !traced {
+ traced = true
+ traceGCMarkAssistStart()
+ }
+
// Perform assist work
systemstack(func() {
gcAssistAlloc1(gp, scanWork)
@@ -503,7 +505,7 @@ retry:
// At this point either background GC has satisfied
// this G's assist debt, or the GC cycle is over.
}
- if trace.enabled {
+ if traced {
traceGCMarkAssistDone()
}
}