RFR (S): 8155233: Lazy coarse map clear
Jon Masamitsu
jon.masamitsu at oracle.com
Thu Apr 28 21:00:36 UTC 2016
On 04/28/2016 01:10 PM, Thomas Schatzl wrote:
> Hi Jon,
>
> On Thu, 2016-04-28 at 10:59 -0700, Jon Masamitsu wrote:
>> http://cr.openjdk.java.net/~tschatzl/8155233/webrev/src/share/vm/gc/g
>> 1/heapRegionRemSet.cpp.frames.html
>>
>> 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.
What I thought was that since _n_coarse_entries was being incremented
at the same time as _coarse_dirty was being set to true
508 _coarse_dirty = true;
509 _n_coarse_entries++;
you could just rely on
526 _coarse_dirty = _n_coarse_entries != 0;
to set _coarse_dirty correctly. But I don't seem to understand this code
very well. I'll study the description you have below. Don't wait for me
is you can push. What you have looks correct.
Jon
>
> 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
> again.
>
> 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 =
> false)
> 2a) one of the sub-remembered sets get coarsened (coarse_dirty = true),
> line 508
> 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.
>
> Thanks,
> Thomas
>
More information about the hotspot-gc-dev
mailing list