aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/proc.go8
-rw-r--r--src/runtime/runtime2.go3
2 files changed, 6 insertions, 5 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 91740d1fa6..30d2a68626 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -849,6 +849,8 @@ func schedinit() {
lockVerifyMSize()
+ sched.midle.init(unsafe.Offsetof(m{}.idleNode))
+
// raceinit must be the first call to race detector.
// In particular, it must be done before mallocinit below calls racemapshadow.
gp := getg()
@@ -6976,8 +6978,7 @@ func schedEnabled(gp *g) bool {
func mput(mp *m) {
assertLockHeld(&sched.lock)
- mp.schedlink = sched.midle
- sched.midle.set(mp)
+ sched.midle.push(unsafe.Pointer(mp))
sched.nmidle++
checkdead()
}
@@ -6990,9 +6991,8 @@ func mput(mp *m) {
func mget() *m {
assertLockHeld(&sched.lock)
- mp := sched.midle.ptr()
+ mp := (*m)(sched.midle.pop())
if mp != nil {
- sched.midle = mp.schedlink
sched.nmidle--
}
return mp
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 6d1f9b13a2..2b79717703 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -665,6 +665,7 @@ type m struct {
park note
alllink *m // on allm
schedlink muintptr
+ idleNode listNodeManual
lockedg guintptr
createstack [32]uintptr // stack that created this thread, it's used for StackRecord.Stack0, so it must align with it.
lockedExt uint32 // tracking for external LockOSThread
@@ -875,7 +876,7 @@ type schedt struct {
// When increasing nmidle, nmidlelocked, nmsys, or nmfreed, be
// sure to call checkdead().
- midle muintptr // idle m's waiting for work
+ midle listHeadManual // idle m's waiting for work
nmidle int32 // number of idle m's waiting for work
nmidlelocked int32 // number of locked m's waiting for work
mnext int64 // number of m's that have been created and next M ID