RFR: 8330626: ZGC: Windows address space placeholders not managed correctly [v2]

Axel Boldt-Christmas aboldtch at openjdk.org
Tue Apr 23 13:07:28 UTC 2024


On Tue, 23 Apr 2024 12:37:46 GMT, Stefan Johansson <sjohanss at openjdk.org> wrote:

>> Please review this fix to correctly manage address space placeholders on Windows.
>> 
>> **Summary**
>> On Windows, when using small pages, we use address space placeholders to ensure consistency of the address space.
>> 
>> When a portion of the address space is mapped these placeholders are replaced by the actual backing and when doing this the size of the placeholder(s) needs to exactly match the size to be backed. For this reason, whenever address space is in use, we split the covering placeholder into multiple `ZGranuleSize` sized placeholders. 
>> 
>> During recent investigations into fragmentation of the ZGC address space, I found that there was a code code path (**currently not in use**) that did not properly manage these placeholders and we could end up in situations where no placeholder was split off when a new chunk of `ZGranuleSize` size was request. The problem is basically an off by one problem in the splitting code and the fix is to avoid this by changing it to first split the covering placeholder into two parts before splitting the part to be used into granules. 
>> 
>> **Testing**
>> * Manual testing using the included GTest as well as sample applications previously triggering the error case.
>> * Tier 1-5 Generational ZGC testing (ongoing)
>
> Stefan Johansson has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Move GTEST_SKIP to setup function
>  - StefanK review 2

The changes looks good.

There might be some value in adding a test which tests all 4 (or 6) ways we can add an area to the free list.
When freeing Area `A`
1. `A` Not adjacent - Uses `create`
2. `A` In-between two areas (adjacent front and back of free areas) - Uses `grow_from_back`
3. `A` Only adjacent front of freed area  - Uses `grow_from_front`
4.  `A` Only adjacent back of freed area - Uses `grow_from_back`

The rest are just special cases when we add at the end.
5. `A` Not adjacent, higher than all freed areas - Uses `create`
6.  `A` Only adjacent back of last freed area - Uses `grow_from_back`

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

Marked as reviewed by aboldtch (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18912#pullrequestreview-2017194931


More information about the hotspot-dev mailing list