Unionize actor heap large and small chunks #4568
Open
+359
−262
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So they can better fight for their rights..
Prior to this commit, small_chunk_t and large_chunk_t were distinct types. This was great for correctness but prevented a useful optimization.
This commit changes things so that small_chunk_t and large_chunk_t have been combined into chunk_t which has a union in it for the small/large chunk specific fields. There are now a lot of assertions added in the relevant functions that deal with small and large chunks to ensure that the received chunk is of the right type because the compiler can no longer help enforce correctness.
This allows for small and large chunk recycling to take advantage of the fact that the block backing a small chunk is the same size as the block backing the smallest large chunk size allowed so they both now use the same recycled chunk list.
The large chunk recycling has also been enhanced to take advantage of the long tail distribution of allocation sizes and there are now multiple size specific chunk lists for large chunk recycling with one extra large chunk list for recycling that has all chunks bigger than the largest size specific list that is kept sorted and searched/used as the old large chunk recycling list was.