RFC: TLAB allocation and garbage-first policy

Aleksey Shipilev shade at redhat.com
Wed Sep 20 12:28:39 UTC 2017


On 09/20/2017 02:18 PM, Zhengyu Gu wrote:
>> Now to the fun part about our collection policy. Our collector policy selects the regions by least
>> garbage, where garbage = used - live. So, if you have the fragmented 16M region with used=128K, and
>> live=128K, it is exactly 0K garbage -- the least probable candidate. So the region that become
>> fragmented due to the race in TLAB machinery is also never considered for collection, because it is
>> below the ShenandoahGarbageThreshold!
> 
> Should this region be added back to free set after GC and be reused?

In theory, yes -- and this is why it does not crash and burn immediately. In practice, it such
regions seem to get retired due to the same race: unsafe_tlab_alloc says we can fit the TLAB in
region #N, we blink, we try to fit the TLAB in region #N+1, which happens to be half-full, we fail,
we retire the region.

Compacting to get more fully-empty regions reduces the probability of that happening, because it
reduces the number of half-full regions after the cycle.

-Aleksey



More information about the shenandoah-dev mailing list