runtime: fix uncondition calls to traceGCSTWDone

startTheWorldWithSema should call traceGCSTWDone only when
the tracing is enabled.

Change-Id: Ibc7181834f68af3923e4b2aee01a57492ab6213e
Reviewed-on: https://go-review.googlesource.com/c/go/+/330835
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Xiangdong Ji 2021-06-25 21:51:22 +08:00 committed by Gopher Robot
parent 2df6c1abce
commit 8befe0e408
1 changed files with 2 additions and 2 deletions

View File

@ -879,7 +879,7 @@ top:
if restart {
getg().m.preemptoff = ""
systemstack(func() {
now := startTheWorldWithSema(true)
now := startTheWorldWithSema(trace.enabled)
work.pauseNS += now - work.pauseStart
memstats.gcPauseDist.record(now - work.pauseStart)
})
@ -1087,7 +1087,7 @@ func gcMarkTermination() {
throw("failed to set sweep barrier")
}
systemstack(func() { startTheWorldWithSema(true) })
systemstack(func() { startTheWorldWithSema(trace.enabled) })
// Flush the heap profile so we can start a new cycle next GC.
// This is relatively expensive, so we don't do it with the