]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix uncondition calls to traceGCSTWDone
authorXiangdong Ji <xiangdong.ji@gmail.com>
Fri, 25 Jun 2021 13:51:22 +0000 (21:51 +0800)
committerGopher Robot <gobot@golang.org>
Tue, 8 Nov 2022 21:50:06 +0000 (21:50 +0000)
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>

src/runtime/mgc.go

index 0cb507346af937f2ec5b4f733d0f6b52c6add9c9..69dc5433b126e2eb66db2e401c4b592181e79e49 100644 (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