1
0
mirror of https://github.com/golang/go synced 2024-11-23 15:50:07 -07:00

runtime: move pdesc into p

There are currently two arrays indexed by P ID: allp and pdesc.
Consolidate these by moving the pdesc fields into type p so they can
be indexed off allp along with all other per-P state.

For #15131.

Change-Id: Ib6c4e6e7612281a1171ba4a0d62e52fd59e960b4
Reviewed-on: https://go-review.googlesource.com/45572
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
Austin Clements 2017-06-13 11:14:43 -04:00
parent 0253299ab3
commit f4f018518d
2 changed files with 6 additions and 5 deletions

View File

@ -3837,7 +3837,7 @@ func sysmon() {
} }
} }
var pdesc [_MaxGomaxprocs]struct { type sysmontick struct {
schedtick uint32 schedtick uint32
schedwhen int64 schedwhen int64
syscalltick uint32 syscalltick uint32
@ -3855,7 +3855,7 @@ func retake(now int64) uint32 {
if _p_ == nil { if _p_ == nil {
continue continue
} }
pd := &pdesc[i] pd := &_p_.sysmontick
s := _p_.status s := _p_.status
if s == _Psyscall { if s == _Psyscall {
// Retake P from syscall if it's there for more than 1 sysmon tick (at least 20us). // Retake P from syscall if it's there for more than 1 sysmon tick (at least 20us).

View File

@ -455,6 +455,7 @@ type p struct {
link puintptr link puintptr
schedtick uint32 // incremented on every scheduler call schedtick uint32 // incremented on every scheduler call
syscalltick uint32 // incremented on every system call syscalltick uint32 // incremented on every system call
sysmontick sysmontick // last tick observed by sysmon
m muintptr // back-link to associated m (nil if idle) m muintptr // back-link to associated m (nil if idle)
mcache *mcache mcache *mcache
racectx uintptr racectx uintptr