Skip to content

8351011: Serial GC: Use a single VirtualSpace for both young and tenured generations#26

Closed
swesonga wants to merge 23 commits into
mainfrom
swesonga/single-serialgc-virtualspace
Closed

8351011: Serial GC: Use a single VirtualSpace for both young and tenured generations#26
swesonga wants to merge 23 commits into
mainfrom
swesonga/single-serialgc-virtualspace

Conversation

@swesonga
Copy link
Copy Markdown
Member

JEP draft JDK-8350152 (Automatic Heap Sizing for the Serial Garbage Collector) proposes dynamically sizing the young generation using GC overhead and adding support for committing and uncommitting memory depending on global memory pressure. The current implementation of the serial collector reserves a single block of memory for the entire heap then splits it into two ReservedSpaces, one for the young generation and another for the tenured generation. Each of the generations then individually commits and uncommits memory.

One drawback of this approach is that with dynamic sizing of the generations, fixed limits of the reserved spaces for each generation will not be compatible with the newly computed region sizes. A possible workaround is to reserve twice the maximum heap size to enable each generation to grow to the dynamically computed sizes. However, there would now be two memory regions to manage when committing and uncommitting memory.

This PR adds an experimental flag, -XX:+SharedSerialGCVirtualSpace, to enable the use of a single reserved space and dynamically partitioning its committed memory into tenured and young regions for the automatic heap sizing scenario.

The new commit not in previous PRs is 4307f5c

Comment thread src/hotspot/share/gc/serial/serialHeap.cpp Outdated
Comment thread src/hotspot/share/gc/serial/serialHeap.cpp
Comment thread src/hotspot/share/gc/shared/cardTable.cpp
Comment thread src/hotspot/share/gc/shared/cardTable.cpp Outdated
Comment thread src/hotspot/share/gc/shared/cardTable.cpp Outdated
Comment thread src/hotspot/share/gc/shared/cardTable.cpp Outdated
Comment thread src/hotspot/share/gc/serial/serialGCVirtualSpace.hpp Outdated
@brianjstafford
Copy link
Copy Markdown

Some comments/questions added. As you've mentioned, thorough testing w/ and w/o the shared virtual space (and making sure there are no regressions in existing code), along with code coverage testing, will be important.

@swesonga
Copy link
Copy Markdown
Member Author

Some comments/questions added. As you've mentioned, thorough testing w/ and w/o the shared virtual space (and making sure there are no regressions in existing code), along with code coverage testing, will be important.

@brianjstafford - please review the changes I've made to see whether your feedback has been adequately addressed

void resize_covered_region(MemRegion new_region);

// Resize both of the regions covered by the remembered set.
void resize_covered_region_in_shared_virtual_space(MemRegion new_heap_region0, MemRegion new_heap_region1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "covered_regions", i.e., plural?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "covered_regions", i.e., plural?

It is just 1 region from the point of view of the card table. I think my comment here is what I should update. I'll fix the comment in the upstream PR.

@brianjstafford
Copy link
Copy Markdown

Changes look good - just added one minor question for clarification.

Comment thread src/hotspot/share/gc/serial/defNewGeneration.cpp
Comment thread src/hotspot/share/gc/serial/defNewGeneration.hpp Outdated
@swesonga swesonga closed this Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants