RFR: 8338440: Parallel: Improve fragmentation mitigation in Full GC [v2]

Guoxiong Li gli at openjdk.org
Fri Aug 23 12:37:04 UTC 2024


On Fri, 23 Aug 2024 11:25:18 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>>> > But in _split_destination_count, the prefix split means two parts whose destinations locate in different regions but in the same space.
>>> 
>>> Why are they in the "same" space? The purpose of having "split" to support space-boundary so that the first part and the second part are in two spaces.
>> 
>> The `_split_destination_count` is a size to record how many regions the preceding part occupy. The preceding part is moved to one same space and the second part is moved to another space. So now, it seems you are also misled by this ambiguous name, which is a proof that we need to rename it.
>> 
>> 
>> // file psParallelCompact.hpp
>> 
>>   // Number of regions the preceding live words are relocated into.
>>   uint split_destination_count() const { return _split_destination_count; }
>> 
>> 
>> // file psParallelCompact.cpp, method SplitInfo::record
>> 
>>   // How many regions does the preceding part occupy
>>   uint split_destination_count;
>>   if (preceding_live_words == 0) {
>>     split_destination_count = 0;
>>   } else {
>>     if (split_destination + preceding_live_words > sd.region_align_up(split_destination)) {
>>       split_destination_count = 2;
>>     } else {
>>       split_destination_count = 1;
>>     }
>>   }
>
> Since the preceding live words can be relocated to more than one region, I believe you interpret that as "split". However, the word "split" in this class/context is exclusively reserved for "splitting" a region so that "The preceding part is moved to one same space and the second part is moved to another space."
> 
> Relocating into multiple destination-regions is not "split", otherwise, `RegionData::_destination` should contain "split" as well.

> In _split_destination, the prefix split means two parts whose destinations locate in different spaces. But in _split_destination_count, the prefix split means two parts whose destinations locate in different regions but in the same space.

The two `two parts` I mentioned is unclear and ambiguous. To be clearer and be easy to understand, please omit my previous unclear statement, and help judge whether my following understanding is right or not. Thanks.

One source region which needs to be split can be divided into three parts (shown below).
- `first-part-opt-1` contains objects targeted to one region
- `first-part-opt-2` contains objects targeted to another region (but the same space as the target of `first-part-opt-1`)
- `second-part` contains objects targeted to another space
- `first-part-opt-1` and `first-part-opt-2` are optional


source-region:
-----------------------------------------------------------
|  first-part-opt-1  |  first-part-opt-2  |  second-part  |
a--------------------b--------------------c---------------d


Then we have several conclusions:
- the `_split_point` is at the location `c`
- the `_preceding_live_words` is the size of the live objects from `a` to `c`
- the `_split_destination` is the destination of the first object from `a`(not the first object from `c`)
- the `_split_destination_count` has three conditions
  - if the `_preceding_live_words` is `0`, the `_split_destination_count` is `0`, because the `first-part-opt-1` and `first-part-opt-2` don't exist.
  -  if `_split_destination + _preceding_live_words` is larger than `region_align_up(_split_destination)`,  the `_split_destination_count` is `2`, because both `first-part-opt-1` and `first-part-opt-2` exist.
  - otherwise, the `_split_destination_count` is `1` (only `first-part-opt-1` exists)

> However, the word "split" in this class/context is exclusively reserved for "splitting" a region so that "The preceding part is moved to one same space and the second part is moved to another space."

If my understanding is right, I think the word `split` can be used in the context related to the `c` or `from c to else` or `second-part`. And the word `preceding` can be used in the context related to the `a`, `b` or `from 'a'/'b' to else` or `first-part-opt-1/first-part-opt-2`. What do you think about it? If you agree with this convention. I propose to change `_split_destination` to `_preceding_destination` and change `_split_destination_count` to `_preceding_destination_count`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20590#discussion_r1728898444


More information about the hotspot-gc-dev mailing list