RFR(M) JDK-8014555: G1: Memory ordering problem with Conc refinement and card marking
Thomas Schatzl
thomas.schatzl at oracle.com
Wed Oct 2 08:55:33 PDT 2013
Hi,
On Wed, 2013-10-02 at 14:28 +0200, Mikael Gerdin wrote:
> Hi
>
> Please review my fix for the issue discussed in the "G1 question:
> concurrent cleaning of dirty cards" thread on the hotspot-gc-dev mailing
> list.
>
> I'd like someone from the compiler (and runtime? the interpreter uses
> macroAssembler_*, right?) teams to at least look at the changes to:
> macroAssembler_*.cpp
> c1_Runtime_*.cpp
> graphKit.cpp
>
> Problem description:
> G1 has a race where the concurrent refinement thread may miss object
> references in a dirty card.
> The problem arises if the CPU re-orders the load of the old card value
> (which G1 checks to determine if it can skip the barrier)
> before the store to the actual object.
> If that occurs the concurrent refinement thread may have set the card to
> "clean" and proceeded to scan the card but the java thread may have seen
> the "dirty" value and skipped the post barrier.
>
> Suggested fix:
> * Add a memory fence between the store to a java object and the reading
> of the previous card value.
> * Modify the code for handling young regions so that all writes to young
> regions can skip the fence (since it will never be needed for such
> writes). This introduces a new value in the card table for G1 which
> indicates a young region.
Looks good.
Thomas
More information about the hotspot-dev
mailing list