Skip to content

Commit

Permalink
8318619: GenShen: Add configurable threshold for young triggers to ex…
Browse files Browse the repository at this point in the history
…pedite old evacuations

Reviewed-by: kdnilsen
  • Loading branch information
William Kemper committed Oct 23, 2023
1 parent 5e15c2b commit 0c86364
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Expand Up @@ -35,7 +35,6 @@

ShenandoahYoungHeuristics::ShenandoahYoungHeuristics(ShenandoahYoungGeneration* generation)
: ShenandoahGenerationalHeuristics(generation) {
assert(!generation->is_old(), "Young heuristics only accept the young generation");
}


Expand Down Expand Up @@ -136,7 +135,7 @@ bool ShenandoahYoungHeuristics::should_start_gc() {
// gets priority over old-gen marking.
ShenandoahHeap* heap = ShenandoahHeap::heap();

size_t promo_expedite_threshold = (heap->young_generation()->max_capacity() * ShenandoahEvacReserve) / 512;
size_t promo_expedite_threshold = percent_of(heap->young_generation()->max_capacity(), ShenandoahExpeditePromotionsThreshold);
size_t promo_potential = heap->get_promotion_potential();
if (promo_potential > promo_expedite_threshold) {
// Detect unsigned arithmetic underflow
Expand All @@ -150,8 +149,11 @@ bool ShenandoahYoungHeuristics::should_start_gc() {

ShenandoahOldHeuristics* old_heuristics = heap->old_heuristics();
size_t mixed_candidates = old_heuristics->unprocessed_old_collection_candidates();
if (mixed_candidates > 0) {
if (mixed_candidates > ShenandoahExpediteMixedThreshold && !heap->is_concurrent_weak_root_in_progress()) {
// We need to run young GC in order to open up some free heap regions so we can finish mixed evacuations.
// If concurrent weak root processing is in progress, it means the old cycle has chosen mixed collection
// candidates, but has not completed. There is no point in trying to start the young cycle before the old
// cycle completes.
log_info(gc)("Trigger (%s): expedite mixed evacuation of " SIZE_FORMAT " regions",
_space_info->name(), mixed_candidates);
return true;
Expand Down
10 changes: 10 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp
Expand Up @@ -144,6 +144,16 @@
" compact - run GC more frequently and with deeper targets to " \
"free up more memory.") \
\
product(uintx, ShenandoahExpeditePromotionsThreshold, 5, EXPERIMENTAL, \
"When Shenandoah expects to promote at least this percentage " \
"of the young generation, trigger a young collection to " \
"expedite these promotions.") \
range(0,100) \
\
product(uintx, ShenandoahExpediteMixedThreshold, 10, EXPERIMENTAL, \
"When there are this many old regions waiting to be collected, " \
"trigger a mixed collection immediately.") \
\
product(uintx, ShenandoahUnloadClassesFrequency, 1, EXPERIMENTAL, \
"Unload the classes every Nth cycle. Normally affects concurrent "\
"GC cycles, as degenerated and full GCs would try to unload " \
Expand Down

0 comments on commit 0c86364

Please sign in to comment.