Open
Description
Some important and hot data is stored in Ps, such as write barrier buffers and defer pools. Getting from a G to a P currently requires evaluating g.m.p
. We should consider adding a direct link, g.p
, to avoid an extra memory lookup. This should reduce memory lookups and cache pressure / cache misses on hot code, particularly write barrier writes.
This might also enable us to eliminate the mcache.
This requires updating g.p
every time a G gets (un)scheduled.
I took a stab at this but never quite got it working. I hope someone else might.
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
dvyukov commentedon Apr 4, 2018
Sounds reasonable to try.
There are probably few hot things (like the ones required for GC barriers and malloc), so we could also try to cache them in g directly.
josharian commentedon Nov 10, 2018
cc @benesch :)
dvyukov commentedon Nov 10, 2018
I happened to write this code while debugging #27660 yesterday:
https://go-review.googlesource.com/c/go/+/148823/1/src/runtime/proc.go
It has all places for wiring and unwiring g and p marked. Feel free to productionize and submit.