RFR: 8166811: Missing memory fences between memory allocation and refinement

Kim Barrett kim.barrett at oracle.com
Mon Nov 7 19:07:27 UTC 2016


> On Nov 7, 2016, at 1:36 PM, Kim Barrett <kim.barrett at oracle.com> wrote:
>>> src/share/vm/gc/g1/g1RemSet.cpp
>>> 581   // The region could be young.  Cards for young regions are 
>>> dirtied,
>>> 582   // so the post-barrier will filter them out.  However, that
>>> dirtying
>>> 583   // is performed concurrently.  A write to a young object could
>>> occur
>>> 584   // before the card has been dirtied, slipping past the filter.
>>> 
>>> This is a rewording of the comment that used to be here.  However, it
>>> was not true even before these changes.  As part of JDK-8014555 we
>>> mark young region cards with g1_young_card_val().  That's the change
>>> set that added the storeload to the post-barrier.
>>> 
>>> I'm not quite sure what to do about this. The comment is currently
>>> wrong.  However, the storeload is considered a problem, and there
>>> have been various ideas discussed for eliminating it that might allow
>>> us to go back to dirtying young cards.
>> 
>> Depends on what "dirtying" is supposed to mean in this context -
>> setting it to "dirty" or setting it to something non-clean.
>> 
>> One could replace "dirtied" by something less specific here to make it
>> right again.
> 
> Good idea.  How about this rewording (using “set to a value”)
> 
>  // The region could be young.  Cards for young regions are set to a
>  // value that allows the post-barrier to filter them out.  However,
>  // that card setting is performed concurrently.  A write to a young
>  // object could occur before the card has been set, slipping past
>  // the filter.

Oops, no, that isn't right.  (It's been a couple of weeks since I
looked at this, and forgot part of the problem.)

Part of what's wrong with the comment is that we can no longer get to
that point with a young region.  A young region's cards will be either
g1_young_gen or clean, never dirty.  Hence the filtering out of
non-dirty cards a few lines before this comment will have already
discarded a young card before we reach the test this comment is
discussing.  So the whole premise of the comment in question, that the
region could be young, is false.




More information about the hotspot-dev mailing list