aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-11-04 14:25:22 -0800
committerIan Lance Taylor <iant@golang.org>2020-02-24 16:39:52 +0000
commit3093959ee10f5c28211094e784c954f6a304b9c9 (patch)
tree52ce31ecacb6575a97097a193bb2abefc620c06c /src/runtime/stack.go
parent7802b551769c9f39e2b08a13f7ba2b4e5c521f9e (diff)
downloadgo-3093959ee10f5c28211094e784c954f6a304b9c9.tar.xz
runtime: remove mcache field from m
Having an mcache field in both m and p is confusing, so remove it from m. Always use mcache field from p. Use new variable mcache0 during bootstrap. Change-Id: If2cba9f8bb131d911d512b61fd883a86cf62cc98 Reviewed-on: https://go-review.googlesource.com/c/go/+/205239 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/stack.go')
-rw-r--r--src/runtime/stack.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index ebbe3e013d..e72a75cdef 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -357,16 +357,16 @@ func stackalloc(n uint32) stack {
n2 >>= 1
}
var x gclinkptr
- c := thisg.m.mcache
- if stackNoCache != 0 || c == nil || thisg.m.preemptoff != "" {
- // c == nil can happen in the guts of exitsyscall or
- // procresize. Just get a stack from the global pool.
+ if stackNoCache != 0 || thisg.m.p == 0 || thisg.m.preemptoff != "" {
+ // thisg.m.p == 0 can happen in the guts of exitsyscall
+ // or procresize. Just get a stack from the global pool.
// Also don't touch stackcache during gc
// as it's flushed concurrently.
lock(&stackpool[order].item.mu)
x = stackpoolalloc(order)
unlock(&stackpool[order].item.mu)
} else {
+ c := thisg.m.p.ptr().mcache
x = c.stackcache[order].list
if x.ptr() == nil {
stackcacherefill(c, order)
@@ -452,12 +452,12 @@ func stackfree(stk stack) {
n2 >>= 1
}
x := gclinkptr(v)
- c := gp.m.mcache
- if stackNoCache != 0 || c == nil || gp.m.preemptoff != "" {
+ if stackNoCache != 0 || gp.m.p == 0 || gp.m.preemptoff != "" {
lock(&stackpool[order].item.mu)
stackpoolfree(x, order)
unlock(&stackpool[order].item.mu)
} else {
+ c := gp.m.p.ptr().mcache
if c.stackcache[order].size >= _StackCacheSize {
stackcacherelease(c, order)
}