jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8332455: Improve G1/ParallelGC tasks to not override array lengths

Open rkennke opened this issue 9 months ago • 5 comments

In order to not cause excessive traffic on task queues when scanning large object arrays, G1 and ParallelGC use a way of slicing those arrays into smaller pieces. It overrides the from-space array's length field to track the array slices.

I think it would be cleaner if we improve the tasks such that array slices can be fully encoded in the task and does not require overriding the array length.

This PR borrows the principal encoding and slicing algorithm from Shenandoah (originally written by @shipilev). It also unifies the slicing implementations of the young GC and concurrent marking GC and ParallelGC.

On x86 (32-bit) we don't have enough bits in the single-word task to encode the slicing, so I'm extending the task to 64 bits (pointer and two int32 fields).

I put in some efforts to make sure the shared array slicing uses the user-configurable flags ParGCArrayScanChunk and ObjArrayMarkingStride just as before, but TBH, I don't see the point of having those flags as product flags to begin with. I would probably deprecate and remove ParGCArrayScanChunk, and use the develop flag ObjArrayMarkingStride everywhere. YMMV.

Testing:

  • [x] hotspot_gc
  • [x] tier1
  • [x] tier2

Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue

Issue

  • JDK-8332455: Improve G1/ParallelGC tasks to not override array lengths (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19282/head:pull/19282
$ git checkout pull/19282

Update a local copy of the PR:
$ git checkout pull/19282
$ git pull https://git.openjdk.org/jdk.git pull/19282/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19282

View PR using the GUI difftool:
$ git pr show -t 19282

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19282.diff

rkennke avatar May 17 '24 12:05 rkennke