JDK-8344593 : GenShen: Review of ReduceInitialCardMarks
  • Type: Task
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: repo-shenandoah
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-11-19
  • Updated: 2024-12-16
  • Resolved: 2024-12-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 b02Fixed
Related Reports
Relates :  
Description
ReduceInitialCardMarks was introduced around JDK 6 as a means of eliding card-marking barriers for generational collectors for initializing stores to objects. When objects are created in Eden, card marking isn't needed for any of our current collectors (G1's global marking is a more complicated case that I won't consider since it's different from GenShen's SATB). However, if these objects are not allocated in Eden, the card marks are needed for initializing stores. For stop-world collectors, such as Parallel GC or Serial GC, these card marks for initializing stores to objects allocated in the old generation can be deferred until the next subsequent safepoint. This defering allows card-marks to be batched, reducing writes to the card table, although repeated writes to the same card will find it in the L1D$.

In current GenShen code, we use the same controls to elide card marks for initializing writes to objects, which will always start life in the younger Generation by construction/design. Thus, eliding the card marks should be safe, and indeed we should never need to compensate for this elision by deferring the card marks as described above for Serial and Parallel GC which can slow-path-allocate directly into the old generation. The promotion of objects to the old generation by GenShen dirties the cards that have cross-generational pointers.

However, the code for ReduceInitialCardMarks has undergone a few changes since it was first introduced into HotSpot/C2 almost 15 or more years ago, and GenShen uses some aspects of the shared card marking code. We should review the code to understand its current state, determine if it is appropriate in its current form for GenShen to use ReduceInitialCardMarks to elide the card marks for initializing stores, and check if it helps performance.

This ticket is to review its correctness for GenShen, and collect performance data & document any observed benefits or otherwise.

Backlink to Aleksey's review comment that prompted this rereview: https://github.com/openjdk/jdk/pull/21273#discussion_r1839969170
Comments
Changeset: a97dca52 Branch: master Author: Y. Srinivas Ramakrishna <ysr@openjdk.org> Date: 2024-12-05 19:46:39 +0000 URL: https://git.openjdk.org/jdk/commit/a97dca52c9257121fc96613a4b591920c1c3e31a
05-12-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/22507 Date: 2024-12-03 02:41:26 +0000
03-12-2024

A review of the code related to ReduceInitialCardMarks with GenShen has not indicated any issues. The comment associated with eliding card-marks has been fixed up. No code changes are needed. The updated comment will be reviewed and landed once a more complete suite of performance results is at hand.
27-11-2024

In preliminary tests (SPECjbb on Intel), no difference in performance or correctness (tests) was noted between +/- ReduceInitialCardMarks. More extensive performance tests and a detailed review of the code is in progress.
22-11-2024