From: Russ Cox Date: Tue, 6 Jan 2015 18:56:21 +0000 (-0500) Subject: runtime: adjust dropm for write barriers X-Git-Tag: go1.5beta1~2437 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9b638bf1bf247f228ebd3db58134acb7a87e3b3e;p=gostls13.git runtime: adjust dropm for write barriers The line 'mp.schedlink = mnext' has an implicit write barrier call, which needs a valid g. Move it above the setg(nil). Change-Id: If3e86c948e856e10032ad89f038bf569659300e0 Reviewed-on: https://go-review.googlesource.com/2347 Reviewed-by: Minux Ma Reviewed-by: Rick Hudson --- diff --git a/src/runtime/proc1.go b/src/runtime/proc1.go index 6fcbd6946a..22ea7a9d27 100644 --- a/src/runtime/proc1.go +++ b/src/runtime/proc1.go @@ -960,12 +960,13 @@ func dropm() { unminit() // Clear m and g, and return m to the extra list. - // After the call to setmg we can only call nosplit functions. + // After the call to setg we can only call nosplit functions + // with no pointer manipulation. mp := getg().m - setg(nil) - mnext := lockextra(true) mp.schedlink = mnext + + setg(nil) unlockextra(mp) }