RFR (S): 8155233: Lazy coarse map clear
thomas.schatzl at oracle.com
Thu Apr 28 20:10:21 UTC 2016
On Thu, 2016-04-28 at 10:59 -0700, Jon Masamitsu wrote:
> When is this not sufficient
> 526 _coarse_dirty = _n_coarse_entries != 0;
> such that you need to set _coarse_dirty here?
> 508 _coarse_dirty = true;
Not completely sure about the question, these seem to be unrelated. 508
deals with the case when we set any bit in the coarse bitmap while
adding any references. If so, we can't optimize out the clear() in line
652, when the remembered set should be freed.
Line 526 is about the case when we find that the coarse map has been
cleared by the scrubbing again, before the remembered set is freed
While looking at this again I forgot to add an obvious optimization: if
we know that the coarse map is not dirty, we do not need to scrub it
(call G1CardLiveData::remove_nonlive_regions() on it)... that should
help a bit with scrubbing time. I will add that tomorrow. :)
Maybe let me tell you a bit about the life cycle of remembered sets:
1) initially it is empty, the region corresponding region is free
(there is a 1:1 mapping of regions and remembered sets right now)
(coarse_dirty = false)
2) region is allocated, entries get added to the remset (coarse_dirty =
2a) one of the sub-remembered sets get coarsened (coarse_dirty = true),
2b) all coarse map entries are scrubbed away/cleared (line 526 ->
coarse_dirty = false)
3) region is freed, need to clear the remembered set to prepare it for
next use. Depending on coarse_dirty, also reset the coarse map set.
(coarse_dirty = false, line 652)
Maybe this helps a little. Otherwise, keep asking.
More information about the hotspot-gc-dev