aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/trace2runtime.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/trace2runtime.go')
-rw-r--r--src/runtime/trace2runtime.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/runtime/trace2runtime.go b/src/runtime/trace2runtime.go
index a9c8d8a590..9638e4b924 100644
--- a/src/runtime/trace2runtime.go
+++ b/src/runtime/trace2runtime.go
@@ -192,7 +192,12 @@ func traceAcquireEnabled() traceLocker {
// Prevent preemption.
mp := acquirem()
- // Acquire the trace seqlock.
+ // Acquire the trace seqlock. This prevents traceAdvance from moving forward
+ // until all Ms are observed to be outside of their seqlock critical section.
+ //
+ // Note: The seqlock is mutated here and also in traceCPUSample. If you update
+ // usage of the seqlock here, make sure to also look at what traceCPUSample is
+ // doing.
seq := mp.trace.seqlock.Add(1)
if debugTraceReentrancy && seq%2 != 1 {
throw("bad use of trace.seqlock or tracer is reentrant")