aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack1.go
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2014-11-21 16:46:27 -0500
committerRick Hudson <rlh@golang.org>2014-11-21 16:46:27 -0500
commit273507aa8f17b2b619934ae63c99a2e31a4df5e2 (patch)
tree1802cfe9bd278b0df72d2fc5ce562987939316cc /src/runtime/stack1.go
parent8c3f64022a34c140853a3ec6a3be5695e6c05de2 (diff)
downloadgo-273507aa8f17b2b619934ae63c99a2e31a4df5e2.tar.xz
[dev.garbage] runtime: Stop running gs during the GCscan phase.
Ensure that all gs are in a scan state when their stacks are being scanned. LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/179160044
Diffstat (limited to 'src/runtime/stack1.go')
-rw-r--r--src/runtime/stack1.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/stack1.go b/src/runtime/stack1.go
index 78bcccc41b..57d0f8c65e 100644
--- a/src/runtime/stack1.go
+++ b/src/runtime/stack1.go
@@ -682,7 +682,12 @@ func newstack() {
gothrow("runtime: g is running but p is not")
}
if gp.preemptscan {
+ for !castogscanstatus(gp, _Gwaiting, _Gscanwaiting) {
+ // Likely to be racing with the GC as it sees a _Gwaiting and does the stack scan.
+ // If so this stack will be scanned twice which does not change correctness.
+ }
gcphasework(gp)
+ casfrom_Gscanstatus(gp, _Gscanwaiting, _Gwaiting)
casgstatus(gp, _Gwaiting, _Grunning)
gp.stackguard0 = gp.stack.lo + _StackGuard
gp.preempt = false