RFR: 8266821: G1: Prefetch cards during merge heap roots phase

Kim Barrett kbarrett at openjdk.java.net
Tue May 11 17:32:04 UTC 2021


On Tue, 11 May 2021 13:06:59 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   can I have reviews for this change that improves performance of the merge heap roots phase in g1?
> 
> Merging heap roots (remembered sets and log buffers) into the card table for later scanning to a large degree constitutes random accesses to the card table.
> 
> Putting a small prefetch queue between calculating the card table address and inspecting the given card table value decreases merge remembered set time by 20-30% and merge log buffers time by 40-50% (on x64. AArch64 shows similar if not better improvements).
> 
> Applications not having a significant amount of either remembered sets or log buffers do not show significant difference. 
> 
> The cache size constants for arm64 and x86 were derived from testing with a benchmark creating lots of references and log buffers (i.e. BigRamTester). Could not do any corresponding tests on other architectures due to lack of machines.
> 
> Testing: tier1-3, lots of tier1-tier8 runs with [JDK-8017163](https://bugs.openjdk.java.net/browse/JDK-8017163).

Changes requested by kbarrett (Reviewer).

src/hotspot/cpu/arm/gc/g1/g1Globals_arm.hpp line 24:

> 22:  */
> 23: 
> 24: #ifndef CPU_AARCH64_GC_G1_G1GLOBALS_ARM_HPP

s/AARCH64/ARM/ in 3 places in this file.  Similar changes in all the other non-aarch64 files.

src/hotspot/share/gc/g1/g1CardTable.hpp line 97:

> 95: 
> 96:   // Mark the given card as Dirty if it is Clean. Returns whether the card has
> 97:   // been Clean before this operation. This result may be inaccurate as it does not

s/card has been Clean/card was Clean/

src/hotspot/share/gc/g1/g1RemSet.cpp line 1071:

> 1069:   static const uint CacheSize = G1MergeHeapRootsPrefetchCacheSize;
> 1070: 
> 1071:   STATIC_ASSERT(is_power_of_2(CacheSize));

Prefer C++11 `static_assert` (with an informative message).

src/hotspot/share/gc/g1/g1RemSet.cpp line 1081:

> 1079: 
> 1080: protected:
> 1081:   // Initial content of all elements in the cache. It's value be "neutral", i.e.

s/value be/value should be/

src/hotspot/share/gc/g1/g1RemSet.cpp line 1084:

> 1082:   // no work done on it.
> 1083:   G1CardTable::CardValue _dummy_card;
> 1084: 

This class should have a protected default destructor.

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

PR: https://git.openjdk.java.net/jdk/pull/3975


More information about the hotspot-dev mailing list