]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: only read pp.m in schedtrace if needed
authorNicolas Hillegeer <aktau@google.com>
Thu, 12 Dec 2024 16:35:17 +0000 (08:35 -0800)
committerGopher Robot <gobot@golang.org>
Tue, 18 Feb 2025 16:13:46 +0000 (08:13 -0800)
Change-Id: Iad3353431a2ef97c1e0c440bdd84b78cb5ea990e
Reviewed-on: https://go-review.googlesource.com/c/go/+/635635
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Nicolas Hillegeer <aktau@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/runtime/proc.go

index ce6cf88d0cb19ffe8e9309627f790a2defde4455..c9d04edd07fe20215360c09c9c4750533030d83c 100644 (file)
@@ -6391,11 +6391,11 @@ func schedtrace(detailed bool) {
        // Even if we hold schedlock, most data can be changed concurrently.
        // E.g. (p->m ? p->m->id : -1) can crash if p->m changes from non-nil to nil.
        for i, pp := range allp {
-               mp := pp.m.ptr()
                h := atomic.Load(&pp.runqhead)
                t := atomic.Load(&pp.runqtail)
                if detailed {
                        print("  P", i, ": status=", pp.status, " schedtick=", pp.schedtick, " syscalltick=", pp.syscalltick, " m=")
+                       mp := pp.m.ptr()
                        if mp != nil {
                                print(mp.id)
                        } else {