Repository navigation
Optimizing TSD and thread cache layout. - #752
Conversation
|
Only the top commit "Optimizing TSD and thread cache layout." is relevant. |
With the tcache change, we plan to leave some blank space when !config_debug (unused tbins, witnesses) at the end of the tsd. Let's not touch the memory.
|
I think this works better with a helper "Get bin N" function. This introduces enough fiddly details into every tcache access that I think we should be pretty skeptical of doing it without performance data backing it up. |
|
@davidtgoldblatt: yeah a get_bin helper makes sense. I'll update the diff with that. Regarding perf data, u-benchmark confirms no regression with this. Since this is pretty tightly coupled with #736, I'd say let's land this and benchmark together? |
|
Seems reasonable. |
1) Re-organize TSD so that frequently accessed fields are closer to the beginning and more compact. Assuming 64-bit, the first 2.5 cachelines now contains everything needed on tcache fast path, expect the tcache struct itself. 2) Re-organize tcache and tbins. Take lg_fill_div out of tbin, and reduce tbin to 24 bytes (down from 32). Split tbins into tbins_small and tbins_large, and place tbins_small close to the beginning.
|
Just updated with: I have the 2 explicit versions instead of just tcache_bin_get() and checks bin index internal, because:
So in the end I went with the two getters above. |
Re-organize TSD so that frequently accessed fields are closer to the
beginning and more compact. Assuming 64-bit, the first 3.5 cachelines now
contains everything needed on tcache fast path, expect the tcache struct itself.
Re-organize tcache and tbins. Take lg_fill_div out of tbin, and reduce tbin
to 24 bytes (down from 32). Split tbins into tbins_small and tbins_large, and
place tbins_small close to the beginning.