Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8298647: GenShen require heap size 2MB granularity #202

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
Expand Up @@ -23,6 +23,7 @@
*/

#include "precompiled.hpp"
#include "gc/shared/cardTableRS.hpp"
#include "gc/shared/space.inline.hpp"
#include "gc/shared/tlab_globals.hpp"
#include "gc/shenandoah/shenandoahCardTable.hpp"
Expand Down Expand Up @@ -724,6 +725,9 @@ size_t ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) {
FLAG_SET_DEFAULT(ShenandoahMinRegionSize, MIN_REGION_SIZE);
}

// Generational Shenandoah needs this alignment for card tables.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for this fix! It would be nice if this constraint were only applied for generation mode, but these sizes are computed quite earlier during startup. You'd need to factor the code out of ShenandoahHeap::initialize_heuristics to know whether the constraint is required at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I thought I'd start with a simple fix to highlight the problem first. I experimented with exactly what you suggested, parsing ShenandoahGCMode. I can update this the 2MB alignment isn't desired unconditionally.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes please. We've tried to limit the impact of the generational mode on Shenandoah's other modes.

max_heap_size = align_up(max_heap_size , CardTableRS::ct_max_alignment_constraint());

size_t region_size;
if (FLAG_IS_DEFAULT(ShenandoahRegionSize)) {
if (ShenandoahMinRegionSize > max_heap_size / MIN_NUM_REGIONS) {
Expand Down