8222185: Shenandoah should report "committed" as capacity
Reviewed-by: zgu, rkennke
This commit is contained in:
parent
5952e2bc64
commit
6453df40be
@ -72,7 +72,7 @@ void ShenandoahAdaptiveHeuristics::choose_collection_set_from_regiondata(Shenand
|
||||
// we hit max_cset. When max_cset is hit, we terminate the cset selection. Note that in this scheme,
|
||||
// ShenandoahGarbageThreshold is the soft threshold which would be ignored until min_garbage is hit.
|
||||
|
||||
size_t capacity = ShenandoahHeap::heap()->capacity();
|
||||
size_t capacity = ShenandoahHeap::heap()->max_capacity();
|
||||
size_t free_target = ShenandoahMinFreeThreshold * capacity / 100;
|
||||
size_t min_garbage = free_target > actual_free ? (free_target - actual_free) : 0;
|
||||
size_t max_cset = (size_t)(1.0 * ShenandoahEvacReserve * capacity / 100 / ShenandoahEvacWaste);
|
||||
@ -123,12 +123,12 @@ void ShenandoahAdaptiveHeuristics::record_phase_time(ShenandoahPhaseTimings::Pha
|
||||
|
||||
bool ShenandoahAdaptiveHeuristics::should_start_normal_gc() const {
|
||||
ShenandoahHeap* heap = ShenandoahHeap::heap();
|
||||
size_t capacity = heap->capacity();
|
||||
size_t capacity = heap->max_capacity();
|
||||
size_t available = heap->free_set()->available();
|
||||
|
||||
// Check if we are falling below the worst limit, time to trigger the GC, regardless of
|
||||
// anything else.
|
||||
size_t min_threshold = ShenandoahMinFreeThreshold * heap->capacity() / 100;
|
||||
size_t min_threshold = ShenandoahMinFreeThreshold * heap->max_capacity() / 100;
|
||||
if (available < min_threshold) {
|
||||
log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below minimum threshold (" SIZE_FORMAT "M)",
|
||||
available / M, min_threshold / M);
|
||||
@ -138,7 +138,7 @@ bool ShenandoahAdaptiveHeuristics::should_start_normal_gc() const {
|
||||
// Check if are need to learn a bit about the application
|
||||
const size_t max_learn = ShenandoahLearningSteps;
|
||||
if (_gc_times_learned < max_learn) {
|
||||
size_t init_threshold = ShenandoahInitFreeThreshold * heap->capacity() / 100;
|
||||
size_t init_threshold = ShenandoahInitFreeThreshold * heap->max_capacity() / 100;
|
||||
if (available < init_threshold) {
|
||||
log_info(gc)("Trigger: Learning " SIZE_FORMAT " of " SIZE_FORMAT ". Free (" SIZE_FORMAT "M) is below initial threshold (" SIZE_FORMAT "M)",
|
||||
_gc_times_learned + 1, max_learn, available / M, init_threshold / M);
|
||||
|
@ -53,8 +53,8 @@ bool ShenandoahCompactHeuristics::should_start_normal_gc() const {
|
||||
ShenandoahHeap* heap = ShenandoahHeap::heap();
|
||||
|
||||
size_t available = heap->free_set()->available();
|
||||
size_t threshold_bytes_allocated = heap->capacity() * ShenandoahAllocationThreshold / 100;
|
||||
size_t min_threshold = ShenandoahMinFreeThreshold * heap->capacity() / 100;
|
||||
size_t threshold_bytes_allocated = heap->max_capacity() * ShenandoahAllocationThreshold / 100;
|
||||
size_t min_threshold = ShenandoahMinFreeThreshold * heap->max_capacity() / 100;
|
||||
|
||||
if (available < min_threshold) {
|
||||
log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below minimum threshold (" SIZE_FORMAT "M)",
|
||||
|
@ -81,7 +81,7 @@ void ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(Shenando
|
||||
|
||||
// Do not select too large CSet that would overflow the available free space.
|
||||
// Take at least the entire evacuation reserve, and be free to overflow to free space.
|
||||
size_t capacity = ShenandoahHeap::heap()->capacity();
|
||||
size_t capacity = ShenandoahHeap::heap()->max_capacity();
|
||||
size_t available = MAX2(ShenandoahEvacReserve * capacity / 100, actual_free);
|
||||
size_t max_cset = (size_t)(available / ShenandoahEvacWaste);
|
||||
|
||||
|
@ -52,7 +52,7 @@ ShenandoahStaticHeuristics::~ShenandoahStaticHeuristics() {}
|
||||
bool ShenandoahStaticHeuristics::should_start_normal_gc() const {
|
||||
ShenandoahHeap* heap = ShenandoahHeap::heap();
|
||||
|
||||
size_t capacity = heap->capacity();
|
||||
size_t capacity = heap->max_capacity();
|
||||
size_t available = heap->free_set()->available();
|
||||
size_t threshold_available = (capacity * ShenandoahFreeThreshold) / 100;
|
||||
|
||||
|
@ -124,7 +124,7 @@ void ShenandoahTraversalHeuristics::choose_collection_set(ShenandoahCollectionSe
|
||||
// The significant complication is that liveness data was collected at the previous cycle, and only
|
||||
// for those regions that were allocated before previous cycle started.
|
||||
|
||||
size_t capacity = heap->capacity();
|
||||
size_t capacity = heap->max_capacity();
|
||||
size_t actual_free = heap->free_set()->available();
|
||||
size_t free_target = ShenandoahMinFreeThreshold * capacity / 100;
|
||||
size_t min_garbage = free_target > actual_free ? (free_target - actual_free) : 0;
|
||||
@ -213,12 +213,12 @@ bool ShenandoahTraversalHeuristics::should_start_traversal_gc() {
|
||||
ShenandoahHeap* heap = ShenandoahHeap::heap();
|
||||
assert(!heap->has_forwarded_objects(), "no forwarded objects here");
|
||||
|
||||
size_t capacity = heap->capacity();
|
||||
size_t capacity = heap->max_capacity();
|
||||
size_t available = heap->free_set()->available();
|
||||
|
||||
// Check if we are falling below the worst limit, time to trigger the GC, regardless of
|
||||
// anything else.
|
||||
size_t min_threshold = ShenandoahMinFreeThreshold * heap->capacity() / 100;
|
||||
size_t min_threshold = ShenandoahMinFreeThreshold * heap->max_capacity() / 100;
|
||||
if (available < min_threshold) {
|
||||
log_info(gc)("Trigger: Free (" SIZE_FORMAT "M) is below minimum threshold (" SIZE_FORMAT "M)",
|
||||
available / M, min_threshold / M);
|
||||
@ -228,7 +228,7 @@ bool ShenandoahTraversalHeuristics::should_start_traversal_gc() {
|
||||
// Check if are need to learn a bit about the application
|
||||
const size_t max_learn = ShenandoahLearningSteps;
|
||||
if (_gc_times_learned < max_learn) {
|
||||
size_t init_threshold = ShenandoahInitFreeThreshold * heap->capacity() / 100;
|
||||
size_t init_threshold = ShenandoahInitFreeThreshold * heap->max_capacity() / 100;
|
||||
if (available < init_threshold) {
|
||||
log_info(gc)("Trigger: Learning " SIZE_FORMAT " of " SIZE_FORMAT ". Free (" SIZE_FORMAT "M) is below initial threshold (" SIZE_FORMAT "M)",
|
||||
_gc_times_learned + 1, max_learn, available / M, init_threshold / M);
|
||||
|
@ -430,7 +430,7 @@ void ShenandoahFreeSet::rebuild() {
|
||||
}
|
||||
|
||||
// Evac reserve: reserve trailing space for evacuations
|
||||
size_t to_reserve = ShenandoahEvacReserve * _heap->capacity() / 100;
|
||||
size_t to_reserve = ShenandoahEvacReserve * _heap->max_capacity() / 100;
|
||||
size_t reserved = 0;
|
||||
|
||||
for (size_t idx = _heap->num_regions() - 1; idx > 0; idx--) {
|
||||
|
@ -502,7 +502,7 @@ void ShenandoahHeap::reset_mark_bitmap() {
|
||||
void ShenandoahHeap::print_on(outputStream* st) const {
|
||||
st->print_cr("Shenandoah Heap");
|
||||
st->print_cr(" " SIZE_FORMAT "K total, " SIZE_FORMAT "K committed, " SIZE_FORMAT "K used",
|
||||
capacity() / K, committed() / K, used() / K);
|
||||
max_capacity() / K, committed() / K, used() / K);
|
||||
st->print_cr(" " SIZE_FORMAT " x " SIZE_FORMAT"K regions",
|
||||
num_regions(), ShenandoahHeapRegion::region_size_bytes() / K);
|
||||
|
||||
@ -615,7 +615,7 @@ void ShenandoahHeap::notify_mutator_alloc_words(size_t words, bool waste) {
|
||||
}
|
||||
|
||||
size_t ShenandoahHeap::capacity() const {
|
||||
return num_regions() * ShenandoahHeapRegion::region_size_bytes();
|
||||
return committed();
|
||||
}
|
||||
|
||||
size_t ShenandoahHeap::max_capacity() const {
|
||||
@ -649,8 +649,6 @@ void ShenandoahHeap::op_uncommit(double shrink_before) {
|
||||
}
|
||||
|
||||
if (count > 0) {
|
||||
log_info(gc)("Uncommitted " SIZE_FORMAT "M. Heap: " SIZE_FORMAT "M reserved, " SIZE_FORMAT "M committed, " SIZE_FORMAT "M used",
|
||||
count * ShenandoahHeapRegion::region_size_bytes() / M, capacity() / M, committed() / M, used() / M);
|
||||
control_thread()->notify_heap_changed();
|
||||
}
|
||||
}
|
||||
|
@ -46,12 +46,12 @@ private:
|
||||
ShenandoahHeap* _heap;
|
||||
public:
|
||||
ShenandoahGenerationCounters(ShenandoahHeap* heap) :
|
||||
GenerationCounters("Heap", 1, 1, heap->initial_capacity(), heap->max_capacity(), heap->committed()),
|
||||
GenerationCounters("Heap", 1, 1, heap->initial_capacity(), heap->max_capacity(), heap->capacity()),
|
||||
_heap(heap)
|
||||
{};
|
||||
|
||||
virtual void update_all() {
|
||||
_current_size->set_value(_heap->committed());
|
||||
_current_size->set_value(_heap->capacity());
|
||||
}
|
||||
};
|
||||
|
||||
@ -94,7 +94,7 @@ void ShenandoahMonitoringSupport::update_counters() {
|
||||
if (UsePerfData) {
|
||||
ShenandoahHeap* heap = ShenandoahHeap::heap();
|
||||
size_t used = heap->used();
|
||||
size_t capacity = heap->capacity();
|
||||
size_t capacity = heap->max_capacity();
|
||||
_heap_counters->update_all();
|
||||
_space_counters->update_all(capacity, used);
|
||||
_heap_region_counters->update();
|
||||
|
@ -153,7 +153,7 @@ void ShenandoahPacer::setup_for_traversal() {
|
||||
void ShenandoahPacer::setup_for_idle() {
|
||||
assert(ShenandoahPacing, "Only be here when pacing is enabled");
|
||||
|
||||
size_t initial = _heap->capacity() * ShenandoahPacingIdleSlack / 100;
|
||||
size_t initial = _heap->max_capacity() * ShenandoahPacingIdleSlack / 100;
|
||||
double tax = 1;
|
||||
|
||||
restart_with(initial, tax);
|
||||
@ -166,7 +166,7 @@ size_t ShenandoahPacer::update_and_get_progress_history() {
|
||||
if (_progress == -1) {
|
||||
// First initialization, report some prior
|
||||
Atomic::store((intptr_t)PACING_PROGRESS_ZERO, &_progress);
|
||||
return (size_t) (_heap->capacity() * 0.1);
|
||||
return (size_t) (_heap->max_capacity() * 0.1);
|
||||
} else {
|
||||
// Record history, and reply historical data
|
||||
_progress_history->add(_progress);
|
||||
|
Loading…
x
Reference in New Issue
Block a user