RFR: 8375541: G1: Race in G1BarrierSet::write_ref_field_post() [v3]
Aleksey Shipilev
shade at openjdk.org
Thu Jan 22 10:44:28 UTC 2026
On Wed, 21 Jan 2026 14:02:31 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
>> Hi all,
>>
>> during conversion of card table code to use `Atomic<T>` I think I found the following error: the code in `G1BarrierSet::write_ref_field_post` is wrong in that it allows reload of the `_card_table` value, which is exactly what the existing code imo wrongly fails to ensure. even if it does not, making the load explicit improves reading.
>>
>> To not let this change get lost in that conversion, and potentially for backport to 26, I factored it out in this change.
>>
>> There is no known issue caused by this code in particular, one other bug I'm working on that just looks like what could be caused by this is not fixed.
>>
>> Testing: gha
>>
>> Thanks,
>> Thomas
>
> Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
>
> * walulyai review
Not sure how much this actually saves us from C++ UB behavior wrt data races, but the fix does not hurt either.
-------------
Marked as reviewed by shade (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/29311#pullrequestreview-3691778816
More information about the hotspot-gc-dev
mailing list