Skip to content

Commit

Permalink
8316299: GenShen: Reduce frequency of expedited GC
Browse files Browse the repository at this point in the history
Reviewed-by: shade, wkemper
  • Loading branch information
kdnilsen committed Sep 15, 2023
1 parent 88365d1 commit aa1063f
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ bool ShenandoahYoungHeuristics::should_start_gc() {
// be done, we start up the young-gen GC threads so they can do some of this old-gen work. As implemented, promotion
// 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_potential = heap->get_promotion_potential();
if (promo_potential > 0) {
if (promo_potential > promo_expedite_threshold) {
// Detect unsigned arithmetic underflow
assert(promo_potential < heap->capacity(), "Sanity");
log_info(gc)("Trigger (%s): expedite promotion of " SIZE_FORMAT "%s",
Expand All @@ -146,17 +148,6 @@ bool ShenandoahYoungHeuristics::should_start_gc() {
return true;
}

size_t promo_in_place_potential = heap->get_promotion_in_place_potential();
if (promo_in_place_potential > 0) {
// Detect unsigned arithmetic underflow
assert(promo_in_place_potential < heap->capacity(), "Sanity");
log_info(gc)("Trigger (%s): expedite promotion in place of " SIZE_FORMAT "%s",
_space_info->name(),
byte_size_in_proper_unit(promo_in_place_potential),
proper_unit_for_byte_size(promo_in_place_potential));
return true;
}

ShenandoahOldHeuristics* old_heuristics = heap->old_heuristics();
size_t mixed_candidates = old_heuristics->unprocessed_old_collection_candidates();
if (mixed_candidates > 0) {
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,6 @@ void ShenandoahFullGC::phase5_epilog() {

// In case this Full GC resulted from degeneration, clear the tally on anticipated promotion.
heap->clear_promotion_potential();
heap->clear_promotion_in_place_potential();

if (heap->mode()->is_generational()) {
// Invoke this in case we are able to transfer memory from OLD to YOUNG.
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/shenandoah/shenandoahGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,7 @@ size_t ShenandoahGeneration::select_aged_regions(size_t old_available, size_t nu

size_t old_consumed = 0;
size_t promo_potential = 0;
size_t anticipated_promote_in_place_live = 0;

heap->clear_promotion_in_place_potential();
heap->clear_promotion_potential();
size_t candidates = 0;
size_t candidates_live = 0;
Expand Down Expand Up @@ -626,7 +624,6 @@ size_t ShenandoahGeneration::select_aged_regions(size_t old_available, size_t nu
}
else {
anticipated_promote_in_place_regions++;
anticipated_promote_in_place_live += r->get_live_data_bytes();
}
}
}
Expand Down Expand Up @@ -662,7 +659,6 @@ size_t ShenandoahGeneration::select_aged_regions(size_t old_available, size_t nu
}
heap->set_pad_for_promote_in_place(promote_in_place_pad);
heap->set_promotion_potential(promo_potential);
heap->set_promotion_in_place_potential(anticipated_promote_in_place_live);
return old_consumed;
}

Expand Down
6 changes: 0 additions & 6 deletions src/hotspot/share/gc/shenandoah/shenandoahGeneration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ class ShenandoahGeneration : public CHeapObj<mtGC>, public ShenandoahSpaceInfo {
// at or above tenure age and which contain more than ShenandoahOldGarbageThreshold
// amounts of garbage.
//
// A side effect performed by this function is to tally up the number of regions and
// the number of live bytes that we plan to promote-in-place during the current GC cycle.
// This information, which is stored with an invocation of heap->set_promotion_in_place_potential(),
// feeds into subsequent decisions about when to trigger the next GC and may identify
// special work to be done during this GC cycle if we choose to abbreviate it.
//
// Returns bytes of old-gen memory consumed by selected aged regions
size_t select_aged_regions(size_t old_available,
size_t num_regions, bool
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,6 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) :
_prepare_for_old_mark(false),
_initial_size(0),
_promotion_potential(0),
_promotion_in_place_potential(0),
_committed(0),
_max_workers(MAX3(ConcGCThreads, ParallelGCThreads, 1U)),
_workers(nullptr),
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ class ShenandoahHeap : public CollectedHeap {
size_t _initial_size;
size_t _minimum_size;
size_t _promotion_potential;
size_t _promotion_in_place_potential;
size_t _pad_for_promote_in_place; // bytes of filler
size_t _promotable_humongous_regions;
size_t _promotable_humongous_usage;
Expand Down Expand Up @@ -453,10 +452,6 @@ class ShenandoahHeap : public CollectedHeap {
inline void set_promotion_potential(size_t val) { _promotion_potential = val; };
inline size_t get_promotion_potential() { return _promotion_potential; };

inline void clear_promotion_in_place_potential() { _promotion_in_place_potential = 0; };
inline void set_promotion_in_place_potential(size_t val) { _promotion_in_place_potential = val; };
inline size_t get_promotion_in_place_potential() { return _promotion_in_place_potential; };

inline void set_pad_for_promote_in_place(size_t pad) { _pad_for_promote_in_place = pad; }
inline size_t get_pad_for_promote_in_place() { return _pad_for_promote_in_place; }

Expand Down

0 comments on commit aa1063f

Please sign in to comment.