diff options
Diffstat (limited to 'src/runtime/stack1.go')
| -rw-r--r-- | src/runtime/stack1.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/runtime/stack1.go b/src/runtime/stack1.go index dda39ce481..8ad331777c 100644 --- a/src/runtime/stack1.go +++ b/src/runtime/stack1.go @@ -208,7 +208,7 @@ func stackalloc(n uint32) stack { } var x gclinkptr c := thisg.m.mcache - if c == nil || thisg.m.gcing != 0 || thisg.m.helpgc != 0 { + if c == nil || thisg.m.preemptoff != "" || thisg.m.helpgc != 0 { // c == nil can happen in the guts of exitsyscall or // procresize. Just get a stack from the global pool. // Also don't touch stackcache during gc @@ -271,7 +271,7 @@ func stackfree(stk stack) { } x := gclinkptr(v) c := gp.m.mcache - if c == nil || gp.m.gcing != 0 || gp.m.helpgc != 0 { + if c == nil || gp.m.preemptoff != "" || gp.m.helpgc != 0 { lock(&stackpoolmu) stackpoolfree(x, order) unlock(&stackpoolmu) @@ -648,7 +648,8 @@ func newstack() { // Be conservative about where we preempt. // We are interested in preempting user Go code, not runtime code. - // If we're holding locks, mallocing, or GCing, don't preempt. + // If we're holding locks, mallocing, or preemption is disabled, don't + // preempt. // This check is very early in newstack so that even the status change // from Grunning to Gwaiting and back doesn't happen in this case. // That status change by itself can be viewed as a small preemption, @@ -658,7 +659,7 @@ func newstack() { // it needs a lock held by the goroutine), that small preemption turns // into a real deadlock. if preempt { - if thisg.m.locks != 0 || thisg.m.mallocing != 0 || thisg.m.gcing != 0 || thisg.m.p.status != _Prunning { + if thisg.m.locks != 0 || thisg.m.mallocing != 0 || thisg.m.preemptoff != "" || thisg.m.p.status != _Prunning { // Let the goroutine keep running for now. // gp->preempt is set, so it will be preempted next time. gp.stackguard0 = gp.stack.lo + _StackGuard |
