mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[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
This commit is contained in:
parent
8c3f64022a
commit
273507aa8f
3 changed files with 14 additions and 15 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue