mirror of
https://github.com/golang/go
synced 2024-11-17 12:54:47 -07:00
runtime: pass M to traceReleaseBuffer
This change is a no-op, but makes the acquire-release pair traceAcquireBuffer / traceReleaseBuffer more explicit, since the former does acquirem and the latter releasm. Change-Id: If8a5b1ba8709bf6f39c8ff27b2d3e0c0b0da0e58 Reviewed-on: https://go-review.googlesource.com/c/go/+/476575 Auto-Submit: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
2a30b34e29
commit
07a25a9f6e
@ -312,7 +312,7 @@ func StartTrace() error {
|
||||
for i, label := range gcMarkWorkerModeStrings[:] {
|
||||
trace.markWorkerLabels[i], bufp = traceString(bufp, pid, label)
|
||||
}
|
||||
traceReleaseBuffer(pid)
|
||||
traceReleaseBuffer(mp, pid)
|
||||
|
||||
unlock(&trace.bufLock)
|
||||
|
||||
@ -676,7 +676,7 @@ func traceEvent(ev byte, skip int, args ...uint64) {
|
||||
//
|
||||
// Note trace_userTaskCreate runs the same check.
|
||||
if !trace.enabled && !mp.startingtrace {
|
||||
traceReleaseBuffer(pid)
|
||||
traceReleaseBuffer(mp, pid)
|
||||
return
|
||||
}
|
||||
|
||||
@ -686,7 +686,7 @@ func traceEvent(ev byte, skip int, args ...uint64) {
|
||||
}
|
||||
}
|
||||
traceEventLocked(0, mp, pid, bufp, ev, 0, skip, args...)
|
||||
traceReleaseBuffer(pid)
|
||||
traceReleaseBuffer(mp, pid)
|
||||
}
|
||||
|
||||
// traceEventLocked writes a single event of type ev to the trace buffer bufp,
|
||||
@ -907,11 +907,11 @@ func traceAcquireBuffer() (mp *m, pid int32, bufp *traceBufPtr) {
|
||||
}
|
||||
|
||||
// traceReleaseBuffer releases a buffer previously acquired with traceAcquireBuffer.
|
||||
func traceReleaseBuffer(pid int32) {
|
||||
func traceReleaseBuffer(mp *m, pid int32) {
|
||||
if pid == traceGlobProc {
|
||||
unlock(&trace.bufLock)
|
||||
}
|
||||
releasem(getg().m)
|
||||
releasem(mp)
|
||||
}
|
||||
|
||||
// lockRankMayTraceFlush records the lock ranking effects of a
|
||||
@ -1499,13 +1499,13 @@ func trace_userTaskCreate(id, parentID uint64, taskType string) {
|
||||
// Same as in traceEvent.
|
||||
mp, pid, bufp := traceAcquireBuffer()
|
||||
if !trace.enabled && !mp.startingtrace {
|
||||
traceReleaseBuffer(pid)
|
||||
traceReleaseBuffer(mp, pid)
|
||||
return
|
||||
}
|
||||
|
||||
typeStringID, bufp := traceString(bufp, pid, taskType)
|
||||
traceEventLocked(0, mp, pid, bufp, traceEvUserTaskCreate, 0, 3, id, parentID, typeStringID)
|
||||
traceReleaseBuffer(pid)
|
||||
traceReleaseBuffer(mp, pid)
|
||||
}
|
||||
|
||||
//go:linkname trace_userTaskEnd runtime/trace.userTaskEnd
|
||||
@ -1521,13 +1521,13 @@ func trace_userRegion(id, mode uint64, name string) {
|
||||
|
||||
mp, pid, bufp := traceAcquireBuffer()
|
||||
if !trace.enabled && !mp.startingtrace {
|
||||
traceReleaseBuffer(pid)
|
||||
traceReleaseBuffer(mp, pid)
|
||||
return
|
||||
}
|
||||
|
||||
nameStringID, bufp := traceString(bufp, pid, name)
|
||||
traceEventLocked(0, mp, pid, bufp, traceEvUserRegion, 0, 3, id, mode, nameStringID)
|
||||
traceReleaseBuffer(pid)
|
||||
traceReleaseBuffer(mp, pid)
|
||||
}
|
||||
|
||||
//go:linkname trace_userLog runtime/trace.userLog
|
||||
@ -1538,7 +1538,7 @@ func trace_userLog(id uint64, category, message string) {
|
||||
|
||||
mp, pid, bufp := traceAcquireBuffer()
|
||||
if !trace.enabled && !mp.startingtrace {
|
||||
traceReleaseBuffer(pid)
|
||||
traceReleaseBuffer(mp, pid)
|
||||
return
|
||||
}
|
||||
|
||||
@ -1561,7 +1561,7 @@ func trace_userLog(id uint64, category, message string) {
|
||||
buf.varint(uint64(slen))
|
||||
buf.pos += copy(buf.arr[buf.pos:], message[:slen])
|
||||
|
||||
traceReleaseBuffer(pid)
|
||||
traceReleaseBuffer(mp, pid)
|
||||
}
|
||||
|
||||
// the start PC of a goroutine for tracing purposes. If pc is a wrapper,
|
||||
|
Loading…
Reference in New Issue
Block a user