RFR: 8310031: Parallel: Implement better work distribution for large object arrays in old gen [v2]
Richard Reingruber
rrich at openjdk.org
Wed Jul 26 21:24:53 UTC 2023
On Wed, 26 Jul 2023 16:16:35 GMT, Richard Reingruber <rrich at openjdk.org> wrote:
>> src/hotspot/share/gc/parallel/psCardTable.cpp line 297:
>>
>>> 295: if (obj_sz >= large_obj_arr_min_words() && cast_to_oop(obj_addr)->is_objArray() &&
>>> 296: obj_addr >= cur_stripe_addr) {
>>> 297: // the last condition is not redundant as we can reach here if an obj starts at space_top
>>
>> I think the comment here must be expanded. As far as I understand you, one can generally assume that the array found here must start in the stripe because either:
>> - the array actually starts in the stripe. Since it is larger than a stripe it must be the rightmost object.
>> - the array covers the whole stripe and doesn't start in the stripe. In this case we would never land here since the check !start_array->object_starts_in_range(cur_stripe_addr, cur_stripe_end_addr) in line 258 filters this out already (no object would start in the stripe)
>> - the array ends in the stripe, but not on the stripe end. In this case the rightmost object is not the array itself..
>>
>> But when the object start array overlaps with the space_top, the start_array->object_starts_in_range(cur_stripe_addr, cur_stripe_end_addr) could return true, if there is an object at space_top. In this case the array would not start in the stripe and the check ensures that.
>
> Thanks for looking at the PR!
> I agree that it's not easy to see what's intended. And it's not that easy to explain either.
> It might be possible to remove the condition and the comment if we check `first_obj_addr >= cur_stripe_end_addr` in L279 and just continue if true.
The guiding principle of `PSCardTable::scavenge_contents_parallel` is to scan only objects that start in the current stripe. There is a special case for the last stripe ending at `space_top` if `space_top` is not card-aligned and an object starts there. With https://github.com/openjdk/jdk/pull/14846/commits/0eb924e1d4dfa1f751a55038063af4f6092be8c2 this is handled explicitly and more clearly to make sure stripes without object starts are skipped right away. This is important for correct handling of large object arrays. IMHO also helpful aside from large arrays.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14846#discussion_r1275495494
More information about the hotspot-dev
mailing list