Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
FEAT: flexible run size index #377
Flexible run size index
Currently a single run of small memory blocks has a fixed size, equal to the size of a single chunk. This choice was made for several reasons, but most importantly is significantly simplified implementation. The downside of this is that the allocation thread scaling gets worse as the requested memory blocks get bigger. For example, a run with unit size of 32 kilobytes only contains a few memory blocks and gets quickly exhausted. This causes the bucket to request blocks from the global heap and that naturally increases contention. The second issue with the fixed size is that blocks as small as 128 kilobytes need to be rounded up the size of a chunk, and that increases the amount of space that is being wasted.
To combat the above issues, a run allocation class will now be able to specify what's the desired number of allocations per run and that number will be used to calculate the number of required chunks. Initially, the number of allocations per run won't be able to exceed the number of bits in the bitmap, but this limitation might be relaxed with introduction of a customizable bitmap size (which will be done as a separate patch).
A new CTL option will be implemented for allocation classes that reflect the number of memory blocks per run. This number will be tunable in runtime.
There are many instances in the code where the assumption of a fixed run size was made.