Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: add g.p #24686

josharian opened this Issue Apr 4, 2018 · 3 comments


None yet
2 participants
Copy link

josharian commented Apr 4, 2018

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.

cc @aclements @dvyukov

@josharian josharian added this to the Unplanned milestone Apr 4, 2018


This comment has been minimized.

Copy link

dvyukov commented 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.


This comment has been minimized.

Copy link
Contributor Author

josharian commented Nov 10, 2018

cc @benesch :)


This comment has been minimized.

Copy link

dvyukov commented Nov 10, 2018

I happened to write this code while debugging #27660 yesterday:
It has all places for wiring and unwiring g and p marked. Feel free to productionize and submit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.