RFR: 8371284: GenShen: Avoid unnecessary card marking [v4]

Y. Srinivas Ramakrishna ysr at openjdk.org
Wed Nov 19 22:32:47 UTC 2025


On Tue, 18 Nov 2025 23:10:42 GMT, Nityanand Rai <duke at openjdk.org> wrote:

>> Exclude young-young, old-old and honor UseCondCardMark in dirty card marking.
>
> Nityanand Rai has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove UseCondCardMark chnages, to decouple issues fixed

Description states:

> Exclude young-young, old-old and honor UseCondCardMark in dirty card marking.

I don't see any change for the latter. I believe `UseCondCardMark` is already enabled with GenShen, and the barrier ode respects it.

Also `Exclude young-young, old-old` skips the part of the change that also skips `young->old`. I'd reword the synopsis to:

> Skips card marks for stores in young generation objects, old -> old, and null stores.

which I think is what the code does.

In the performance comparisons, did you see any effect on remembered set scan times (there are card-scan stats that can be enabled in a "release" (non product) build, as needed).

Left some suggestions for tightening up documentation comment.

Rest looks good. As Aleksey noted, the conditional card marks can of course slow down the mutator, so we want to see if the savings in card scan times (because of skipping old->old, or null writes in old) would make up.

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp line 199:

> 197:   }
> 198:   T heap_oop = RawAccess<>::oop_load(field);
> 199:   if (CompressedOops::is_null(heap_oop)) {

For completeness, add a comment:

 // Null reference store

src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp line 204:

> 202:   oop obj = CompressedOops::decode_not_null(heap_oop);
> 203:   if (!_heap->is_in_young(obj)) {
> 204:     // Young object -> old field stores do not require card mark.

As worded, this comment is wrong (or at least confusing). May be rephrase to:


// Not an old->young reference store

-------------

Marked as reviewed by ysr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28204#pullrequestreview-3484940575
PR Review Comment: https://git.openjdk.org/jdk/pull/28204#discussion_r2543736759
PR Review Comment: https://git.openjdk.org/jdk/pull/28204#discussion_r2543729096


More information about the hotspot-gc-dev mailing list