RFR: 8319373: Serial: Refactor dirty cards scanning during Young GC

Kim Barrett kbarrett at openjdk.org
Mon Nov 6 11:48:14 UTC 2023


On Fri, 3 Nov 2023 12:14:11 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Reading the new code directly is probably easier. The structure is quite similar to its counterpart in Parallel.
> 
> It's mostly perf-neutral, except when dirty cards are scarce. Using `card_scan.java` in [JDK-8310031](https://bugs.openjdk.org/browse/JDK-8310031), I observed ~40% reduction in young-gc pause time with `stride = 32 * 64`.

Just getting started on review, and noticed a few minor things.

src/hotspot/share/gc/serial/cardTableRS.cpp line 354:

> 352:   auto is_word_aligned = [] (const void* const p) {
> 353:       return (((uintptr_t)p) % sizeof(Word)) == 0;
> 354:   };

We have `is_aligned` in `utilities/align.hpp`.  Please use that.

src/hotspot/share/gc/serial/cardTableRS.cpp line 359:

> 357:   constexpr Word clean_word = (Word)-1;
> 358: 
> 359:   CardValue* i = start_card;

I don't much like naming a pointer variable "i".  "i" is a really commonly used index variable name.

src/hotspot/share/gc/serial/cardTableRS.cpp line 379:

> 377:         if (is_dirty(i + j)) {
> 378:           return i + j;
> 379:         }

Instead of duplicating the byte search, this could just break out of the word search.

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

Changes requested by kbarrett (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16492#pullrequestreview-1714894247
PR Review Comment: https://git.openjdk.org/jdk/pull/16492#discussion_r1383163336
PR Review Comment: https://git.openjdk.org/jdk/pull/16492#discussion_r1383165088
PR Review Comment: https://git.openjdk.org/jdk/pull/16492#discussion_r1383168895


More information about the hotspot-gc-dev mailing list