-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: getMCache causes allocation fast path regression #42305
Comments
OK I think we've pretty much confirmed it's the additional function call, not reloading the P. |
What's preventing CC @dr2chase who knows all about mid-stack inlining and inlining costs. |
Aside: Fixing #24686 might let us get rid of mcache entirely. I never managed to get it implemented, but I don't know the runtime as well as you. :) |
There are some failures in last builds for AIX which seem to related to this issue: I've searched really quickly through the buildfarm dashboard but it didn't find any other appearance. |
Huh. That is a problem (write barrier without a P...?) but separate from this one. Just the fact that |
@Helflym Could you file a new issue for that and assign it to me? |
So there are a number of ways to fix this regression. First is to make throw have cost 1, so For (1) and (3), we should add |
A fourth alternative is to change |
I think I'm gonna go with 4. (Credit to @prattmic for coming up with option 4 last week.) |
Change https://golang.org/cl/267157 mentions this issue: |
bent
benchmarks revealed a regression in some community microbenchmarks on 10/26. Bisecting, I discovered that c02134a is to blame.That commit is very simple, so my best guess is it's the fact that we're looking up the M and the P a second time. Also, the compiler doesn't seem to inline
getMCache
which is unfortunate and could be part of it. Not sure why, though. Maybemallogc
is too big?Anyway, we should fix this, probably by manually inlining it back into
mallocgc
and leaving a comment pointing togetMCache
? There are a couple other circumstances where we do this extra dereference where it would be nice to not do so, so maybegetMCache
should take ap
pointer that might be nil? That means potentially doing a second lookup since it's ambiguous whether we don't have a P or just haven't looked it up yet, but even if we do we're only doing it when bootstrapping which is probably fine.@prattmic WDYT?
The text was updated successfully, but these errors were encountered: