diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2020-01-14 19:13:47 +0000 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2020-05-07 04:05:18 +0000 |
commit | 94e61ab94d4ab865cd3f9f73062a1c201bb6584d (patch) | |
tree | 91205e5389797b50e3cfa3bed85c31d45c931950 /src/runtime/runtime2.go | |
parent | 5d9549debb313269a7adabdb271f3d67113fef1a (diff) | |
download | go-94e61ab94d4ab865cd3f9f73062a1c201bb6584d.tar.gz go-94e61ab94d4ab865cd3f9f73062a1c201bb6584d.zip |
runtime/runtime2: pack the sudog struct
This commit moves the isSelect bool below the ticket uint32. The
boolean was consuming 8 bytes of the struct. The uint32 was also
consuming 8 bytes, so we can pack isSelect below the uint32 and save 8
bytes. This reduces the sudog struct from 96 bytes to 88 bytes.
Change-Id: If555cdaf2f5eaa125e2590fc4d113dbc99750738
GitHub-Last-Rev: d63b4e086b17da74e185046dfecb12d58e4f19ac
GitHub-Pull-Request: golang/go#36552
Reviewed-on: https://go-review.googlesource.com/c/go/+/214677
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r-- | src/runtime/runtime2.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 2c566b5424..1fe41cf5b2 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -349,9 +349,6 @@ type sudog struct { g *g - // isSelect indicates g is participating in a select, so - // g.selectDone must be CAS'd to win the wake-up race. - isSelect bool next *sudog prev *sudog elem unsafe.Pointer // data element (may point to stack) @@ -364,6 +361,11 @@ type sudog struct { acquiretime int64 releasetime int64 ticket uint32 + + // isSelect indicates g is participating in a select, so + // g.selectDone must be CAS'd to win the wake-up race. + isSelect bool + parent *sudog // semaRoot binary tree waitlink *sudog // g.waiting list or semaRoot waittail *sudog // semaRoot |