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

Balance evacuation #127

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Original file line number Diff line number Diff line change
@@ -484,6 +484,8 @@ void ShenandoahHeap::initialize_heuristics() {
if (mode()->is_generational()) {
_young_generation->initialize_heuristics(_gc_mode);
_old_generation->initialize_heuristics(_gc_mode);

ShenandoahEvacWaste = ShenandoahGenerationalEvacWaste;
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit, but this would fit better in ShenandoahGenerationalMode::initialize_flags.

}
}

@@ -847,6 +849,12 @@ HeapWord* ShenandoahHeap::allocate_from_gclab_slow(Thread* thread, size_t size)

// Figure out size of new GCLAB, looking back at heuristics. Expand aggressively.
size_t new_size = ShenandoahThreadLocalData::gclab_size(thread) * 2;

// Limit growth of GCLABs to ShenandoahMaxEvacLABRatio * the minimum size. This enables more equitable distribution of
// available evacuation buidget between the many threads that are coordinating in the evacuation effort.
if (ShenandoahMaxEvacLABRatio > 0) {
new_size = MIN2(new_size, PLAB::min_size() * ShenandoahMaxEvacLABRatio);
}
new_size = MIN2(new_size, PLAB::max_size());
new_size = MAX2(new_size, PLAB::min_size());

@@ -897,6 +905,11 @@ HeapWord* ShenandoahHeap::allocate_from_plab_slow(Thread* thread, size_t size, b

// Figure out size of new PLAB, looking back at heuristics. Expand aggressively.
size_t new_size = ShenandoahThreadLocalData::plab_size(thread) * 2;
// Limit growth of PLABs to ShenandoahMaxEvacLABRatio * the minimum size. This enables more equitable distribution of
// available evacuation buidget between the many threads that are coordinating in the evacuation effort.
if (ShenandoahMaxEvacLABRatio > 0) {
new_size = MIN2(new_size, PLAB::min_size() * ShenandoahMaxEvacLABRatio);
}
new_size = MIN2(new_size, PLAB::max_size());
new_size = MAX2(new_size, PLAB::min_size());

37 changes: 34 additions & 3 deletions src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp
Original file line number Diff line number Diff line change
@@ -281,11 +281,42 @@
"Larger values make evacuations more resilient against " \
"evacuation conflicts, at expense of evacuating less on each " \
"GC cycle. Smaller values increase the risk of evacuation " \
"failures, which will trigger stop-the-world Full GC passes. " \
"A minimum value of 1.6 is recommended for Generational " \
"mode of Shenandoah.") \
"failures, which will trigger stop-the-world Full GC passes.") \
range(1.0,100.0) \
\
product(double, ShenandoahGenerationalEvacWaste, 2.0, EXPERIMENTAL, \
"For generational mode, how much waste evacuations produce " \
"within the reserved space. Larger values make evacuations " \
"more resilient against evacuation conflicts, at expense of " \
"evacuating less on each GC cycle. Smaller values increase " \
"the risk of evacuation failures, which will trigger " \
"stop-the-world Full GC passes. The default value for " \
"generational mode is 2.0. The reason for the higher default " \
"value in generational mode is because generational mode " \
"enforces the evacuation budget, triggering degenerated GC " \
"which upgrades to full GC whenever the budget is exceeded.") \
range(1.0,100.0) \
\
product(uintx, ShenandoahMaxEvacLABRatio, 16, EXPERIMENTAL, \
"Potentially, each running thread maintains a PLAB for " \
"evacuating objects into old-gen memory and a GCLAB for " \
"evacuating objects into young-gen memory. Each time a thread " \
"exhausts its PLAB or GCLAB, a new local buffer is allocated. " \
"By default, the new buffer is twice the size of the previous " \
"buffer. The sizes are reset to the minimum at the start of " \
"each GC pass. This parameter limits the growth of evacuation " \
"buffer sizes to its value multiplied by the minimum buffer " \
"size. A higher value allows evacuation allocations to be more " \
"efficient because less synchronization is required by " \
"individual threads. However, a larger value increases the " \
"likelihood of evacuation failures, leading to long " \
"stop-the-world pauses. This is because a large value " \
"allows individual threads to consume large percentages of " \
"the total evacuation budget without necessarily effectively " \
"filling their local evcauation buffers with evacuated " \
"objects. A value of zero means no maximum size is enforced.") \
range(0, 1024) \
\
product(bool, ShenandoahEvacReserveOverflow, true, EXPERIMENTAL, \
"Allow evacuations to overflow the reserved space. Enabling it " \
"will make evacuations more resilient when evacuation " \