зеркало из https://github.com/mozilla/gecko-dev.git
9f3c42a57e
The bin-unused count in memory reports indicates how much memory is used by runs of small and sub-page allocations that is not actually allocated. This is generally thought as an indicator of fragmentation. While this is generally true, with the use of thread local arenas by stylo, combined with how stylo allocates memory, it ends up also being an indicator of wasted memory. For instance, over the lifetime of an AWSY iteration, there are only a few allocations that ends up in the bucket for 2048 allocated bytes. In the "worst" case, there's only one. But the run size for such allocations is 132KiB. Which means just because we're allocating one buffer of size between 1024 and 2048 bytes, we end up wasting 130+KiB. Per thread. Something similar happens with size classes of 512 and 1024, where the run size is respectively 32KiB and 64KiB, and where there's at most a handful of allocations of each class ever happening per thread. Overall, an allocation log from a full AWSY iteration reveals that there are only 448 of 860700 allocations happening on the stylo arenas that involve sizes above (and excluding) 512 bytes, so 0.05%. While there are improvements that can be done to mozjemalloc so that it doesn't waste more than one page per sub-page size class, they are changes that are too low-level to land at this time of the release cycle. However, considering the numbers above and the fact that the stylo arenas are only really meant to avoid lock contention during the heavy parallel work involved, a short term, low risk, strategy is to just delegate all sub-page (> 512, < 4096) and large (>= 4096) to the main arena. Technically speaking, only sub-page allocations are causing this waste, but it's more consistent to just delegate everything above 512 bytes. This should save 132KiB + 64KiB = 196KiB per stylo thread. --HG-- extra : rebase_source : c7233d60305365e76aa124045b1c9492068d9415 |
||
---|---|---|
.. | ||
build | ||
fallible | ||
gtest | ||
mozalloc | ||
replace | ||
volatile | ||
moz.build |