[sgen] Adjust free-ing of empty blocks
authorVlad Brezae <brezaevlad@gmail.com>
Fri, 2 Sep 2016 16:52:20 +0000 (16:52 +0000)
committerVlad Brezae <brezaevlad@gmail.com>
Mon, 12 Sep 2016 14:28:52 +0000 (17:28 +0300)
commitf8c983b0e8cf02f478586d663bc1e11ecc3d0625
treeb8e1d8a99e770a5041e301d18c7a870002412a7e
parente6cec7897e3e2fb2a13b1b7c84df70be409f659c
[sgen] Adjust free-ing of empty blocks

After sweep, depending on the computed allowance, we are freeing empty blocks so that we still keep around enough blocks to fill that allowance (to avoid repeated vmaps).

On both collectors this had the problem that the allowance also accounts for LOS space, which we shouldn't account for in major section heuristics (which means that in LOS intensive benchmarks we only free major sections after the LOS shrinks).

On the concurrent collector, where we have a negative allowance adjustment depending on the duration of the concurrent mark (in order to mimic serial memory usage), we can have very small allowances at the end of a major collection, even 0. This means that we would reserve no empty blocks for later use.

We solve these issues by reserving empty blocks relative to the amount of current alive blocks, which is also the basis of how we compute the allowance in the first place.
mono/sgen/sgen-gc.h
mono/sgen/sgen-marksweep.c
mono/sgen/sgen-memory-governor.c