8139277: Remove ScavengeWithObjectsInToSpace, ParallelOldGCSplitALot, ParallelOldGCSplitInterval, PSAdjustTenuredGenForMinorPause and PSAdjustYoungGenForMajorPause

Reviewed-by: tschatzl, sjohanss
This commit is contained in:
David Lindholm 2015-10-16 14:11:29 +02:00
parent 4500c7fac8
commit 65e88c8313
7 changed files with 14 additions and 385 deletions

View File

@ -529,10 +529,7 @@ void PSAdaptiveSizePolicy::compute_old_gen_free_space(
set_decide_at_full_gc(decide_at_full_gc_true);
adjust_promo_for_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
}
} else if (_avg_minor_pause->padded_average() > gc_minor_pause_goal_sec()) {
// Adjust only for the minor pause time goal
adjust_promo_for_minor_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
} else if(adjusted_mutator_cost() < _throughput_goal) {
} else if (adjusted_mutator_cost() < _throughput_goal) {
// This branch used to require that (mutator_cost() > 0.0 in 1.4.2.
// This sometimes resulted in skipping to the minimize footprint
// code. Change this to try and reduce GC time if mutator time is
@ -670,36 +667,6 @@ void PSAdaptiveSizePolicy::decay_supplemental_growth(bool is_full_gc) {
}
}
void PSAdaptiveSizePolicy::adjust_promo_for_minor_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr, size_t* desired_eden_size_ptr) {
if (PSAdjustTenuredGenForMinorPause) {
if (is_full_gc) {
set_decide_at_full_gc(decide_at_full_gc_true);
}
// If the desired eden size is as small as it will get,
// try to adjust the old gen size.
if (*desired_eden_size_ptr <= _space_alignment) {
// Vary the old gen size to reduce the young gen pause. This
// may not be a good idea. This is just a test.
if (minor_pause_old_estimator()->decrement_will_decrease()) {
set_change_old_gen_for_min_pauses(decrease_old_gen_for_min_pauses_true);
*desired_promo_size_ptr =
_promo_size - promo_decrement_aligned_down(*desired_promo_size_ptr);
} else {
set_change_old_gen_for_min_pauses(increase_old_gen_for_min_pauses_true);
size_t promo_heap_delta =
promo_increment_with_supplement_aligned_up(*desired_promo_size_ptr);
if ((*desired_promo_size_ptr + promo_heap_delta) >
*desired_promo_size_ptr) {
*desired_promo_size_ptr =
_promo_size + promo_heap_delta;
}
}
}
}
}
void PSAdaptiveSizePolicy::adjust_eden_for_minor_pause_time(bool is_full_gc,
size_t* desired_eden_size_ptr) {
@ -733,10 +700,7 @@ void PSAdaptiveSizePolicy::adjust_promo_for_pause_time(bool is_full_gc,
// a change less than the required alignment is probably not worth
// attempting.
if (_avg_minor_pause->padded_average() > _avg_major_pause->padded_average()) {
adjust_promo_for_minor_pause_time(is_full_gc, desired_promo_size_ptr, desired_eden_size_ptr);
// major pause adjustments
} else if (is_full_gc) {
if (_avg_minor_pause->padded_average() <= _avg_major_pause->padded_average() && is_full_gc) {
// Adjust for the major pause time only at full gc's because the
// affects of a change can only be seen at full gc's.
@ -774,44 +738,8 @@ void PSAdaptiveSizePolicy::adjust_eden_for_pause_time(bool is_full_gc,
// a change less than the required alignment is probably not worth
// attempting.
if (_avg_minor_pause->padded_average() > _avg_major_pause->padded_average()) {
adjust_eden_for_minor_pause_time(is_full_gc,
desired_eden_size_ptr);
// major pause adjustments
} else if (is_full_gc) {
// Adjust for the major pause time only at full gc's because the
// affects of a change can only be seen at full gc's.
if (PSAdjustYoungGenForMajorPause) {
// If the promo size is at the minimum (i.e., the old gen
// size will not actually decrease), consider changing the
// young gen size.
if (*desired_promo_size_ptr < _space_alignment) {
// If increasing the young generation will decrease the old gen
// pause, do it.
// During startup there is noise in the statistics for deciding
// on whether to increase or decrease the young gen size. For
// some number of iterations, just try to increase the young
// gen size if the major pause is too long to try and establish
// good statistics for later decisions.
if (major_pause_young_estimator()->increment_will_decrease() ||
(_young_gen_change_for_major_pause_count
<= AdaptiveSizePolicyInitializingSteps)) {
set_change_young_gen_for_maj_pauses(
increase_young_gen_for_maj_pauses_true);
eden_heap_delta = eden_increment_aligned_up(*desired_eden_size_ptr);
*desired_eden_size_ptr = _eden_size + eden_heap_delta;
_young_gen_change_for_major_pause_count++;
} else {
// Record that decreasing the young gen size would decrease
// the major pause
set_change_young_gen_for_maj_pauses(
decrease_young_gen_for_maj_pauses_true);
eden_heap_delta = eden_decrement_aligned_down(*desired_eden_size_ptr);
*desired_eden_size_ptr = _eden_size - eden_heap_delta;
}
}
}
adjust_eden_for_minor_pause_time(is_full_gc, desired_eden_size_ptr);
}
if (PrintAdaptiveSizePolicy && Verbose) {
gclog_or_tty->print_cr(
"PSAdaptiveSizePolicy::adjust_eden_for_pause_time "

View File

@ -134,10 +134,6 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
AdaptivePaddedAverage* avg_major_pause() const { return _avg_major_pause; }
double gc_minor_pause_goal_sec() const { return _gc_minor_pause_goal_sec; }
// Change the young generation size to achieve a minor GC pause time goal
void adjust_promo_for_minor_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr,
size_t* desired_eden_size_ptr);
void adjust_eden_for_minor_pause_time(bool is_full_gc,
size_t* desired_eden_size_ptr);
// Change the generation sizes to achieve a GC pause time goal

View File

@ -1349,13 +1349,6 @@ HeapWord*
PSParallelCompact::compute_dense_prefix(const SpaceId id,
bool maximum_compaction)
{
if (ParallelOldGCSplitALot) {
if (_space_info[id].dense_prefix() != _space_info[id].space()->bottom()) {
// The value was chosen to provoke splitting a young gen space; use it.
return _space_info[id].dense_prefix();
}
}
const size_t region_size = ParallelCompactData::RegionSize;
const ParallelCompactData& sd = summary_data();
@ -1428,220 +1421,9 @@ PSParallelCompact::compute_dense_prefix(const SpaceId id,
}
}
#if 0
// Something to consider: if the region with the best ratio is 'close to' the
// first region w/free space, choose the first region with free space
// ("first-free"). The first-free region is usually near the start of the
// heap, which means we are copying most of the heap already, so copy a bit
// more to get complete compaction.
if (pointer_delta(best_cp, full_cp, sizeof(RegionData)) < 4) {
_maximum_compaction_gc_num = total_invocations();
best_cp = full_cp;
}
#endif // #if 0
return sd.region_to_addr(best_cp);
}
#ifndef PRODUCT
void
PSParallelCompact::fill_with_live_objects(SpaceId id, HeapWord* const start,
size_t words)
{
if (TraceParallelOldGCSummaryPhase) {
tty->print_cr("fill_with_live_objects [" PTR_FORMAT " " PTR_FORMAT ") "
SIZE_FORMAT, p2i(start), p2i(start + words), words);
}
ObjectStartArray* const start_array = _space_info[id].start_array();
CollectedHeap::fill_with_objects(start, words);
for (HeapWord* p = start; p < start + words; p += oop(p)->size()) {
_mark_bitmap.mark_obj(p, words);
_summary_data.add_obj(p, words);
start_array->allocate_block(p);
}
}
void
PSParallelCompact::summarize_new_objects(SpaceId id, HeapWord* start)
{
ParallelCompactData& sd = summary_data();
MutableSpace* space = _space_info[id].space();
// Find the source and destination start addresses.
HeapWord* const src_addr = sd.region_align_down(start);
HeapWord* dst_addr;
if (src_addr < start) {
dst_addr = sd.addr_to_region_ptr(src_addr)->destination();
} else if (src_addr > space->bottom()) {
// The start (the original top() value) is aligned to a region boundary so
// the associated region does not have a destination. Compute the
// destination from the previous region.
RegionData* const cp = sd.addr_to_region_ptr(src_addr) - 1;
dst_addr = cp->destination() + cp->data_size();
} else {
// Filling the entire space.
dst_addr = space->bottom();
}
assert(dst_addr != NULL, "sanity");
// Update the summary data.
bool result = _summary_data.summarize(_space_info[id].split_info(),
src_addr, space->top(), NULL,
dst_addr, space->end(),
_space_info[id].new_top_addr());
assert(result, "should not fail: bad filler object size");
}
void
PSParallelCompact::provoke_split_fill_survivor(SpaceId id)
{
if (total_invocations() % (ParallelOldGCSplitInterval * 3) != 0) {
return;
}
MutableSpace* const space = _space_info[id].space();
if (space->is_empty()) {
HeapWord* b = space->bottom();
HeapWord* t = b + space->capacity_in_words() / 2;
space->set_top(t);
if (ZapUnusedHeapArea) {
space->set_top_for_allocations();
}
size_t min_size = CollectedHeap::min_fill_size();
size_t obj_len = min_size;
while (b + obj_len <= t) {
CollectedHeap::fill_with_object(b, obj_len);
mark_bitmap()->mark_obj(b, obj_len);
summary_data().add_obj(b, obj_len);
b += obj_len;
obj_len = (obj_len & (min_size*3)) + min_size; // 8 16 24 32 8 16 24 32 ...
}
if (b < t) {
// The loop didn't completely fill to t (top); adjust top downward.
space->set_top(b);
if (ZapUnusedHeapArea) {
space->set_top_for_allocations();
}
}
HeapWord** nta = _space_info[id].new_top_addr();
bool result = summary_data().summarize(_space_info[id].split_info(),
space->bottom(), space->top(), NULL,
space->bottom(), space->end(), nta);
assert(result, "space must fit into itself");
}
}
void
PSParallelCompact::provoke_split(bool & max_compaction)
{
if (total_invocations() % ParallelOldGCSplitInterval != 0) {
return;
}
const size_t region_size = ParallelCompactData::RegionSize;
ParallelCompactData& sd = summary_data();
MutableSpace* const eden_space = _space_info[eden_space_id].space();
MutableSpace* const from_space = _space_info[from_space_id].space();
const size_t eden_live = pointer_delta(eden_space->top(),
_space_info[eden_space_id].new_top());
const size_t from_live = pointer_delta(from_space->top(),
_space_info[from_space_id].new_top());
const size_t min_fill_size = CollectedHeap::min_fill_size();
const size_t eden_free = pointer_delta(eden_space->end(), eden_space->top());
const size_t eden_fillable = eden_free >= min_fill_size ? eden_free : 0;
const size_t from_free = pointer_delta(from_space->end(), from_space->top());
const size_t from_fillable = from_free >= min_fill_size ? from_free : 0;
// Choose the space to split; need at least 2 regions live (or fillable).
SpaceId id;
MutableSpace* space;
size_t live_words;
size_t fill_words;
if (eden_live + eden_fillable >= region_size * 2) {
id = eden_space_id;
space = eden_space;
live_words = eden_live;
fill_words = eden_fillable;
} else if (from_live + from_fillable >= region_size * 2) {
id = from_space_id;
space = from_space;
live_words = from_live;
fill_words = from_fillable;
} else {
return; // Give up.
}
assert(fill_words == 0 || fill_words >= min_fill_size, "sanity");
if (live_words < region_size * 2) {
// Fill from top() to end() w/live objects of mixed sizes.
HeapWord* const fill_start = space->top();
live_words += fill_words;
space->set_top(fill_start + fill_words);
if (ZapUnusedHeapArea) {
space->set_top_for_allocations();
}
HeapWord* cur_addr = fill_start;
while (fill_words > 0) {
const size_t r = (size_t)os::random() % (region_size / 2) + min_fill_size;
size_t cur_size = MIN2(align_object_size_(r), fill_words);
if (fill_words - cur_size < min_fill_size) {
cur_size = fill_words; // Avoid leaving a fragment too small to fill.
}
CollectedHeap::fill_with_object(cur_addr, cur_size);
mark_bitmap()->mark_obj(cur_addr, cur_size);
sd.add_obj(cur_addr, cur_size);
cur_addr += cur_size;
fill_words -= cur_size;
}
summarize_new_objects(id, fill_start);
}
max_compaction = false;
// Manipulate the old gen so that it has room for about half of the live data
// in the target young gen space (live_words / 2).
id = old_space_id;
space = _space_info[id].space();
const size_t free_at_end = space->free_in_words();
const size_t free_target = align_object_size(live_words / 2);
const size_t dead = pointer_delta(space->top(), _space_info[id].new_top());
if (free_at_end >= free_target + min_fill_size) {
// Fill space above top() and set the dense prefix so everything survives.
HeapWord* const fill_start = space->top();
const size_t fill_size = free_at_end - free_target;
space->set_top(space->top() + fill_size);
if (ZapUnusedHeapArea) {
space->set_top_for_allocations();
}
fill_with_live_objects(id, fill_start, fill_size);
summarize_new_objects(id, fill_start);
_space_info[id].set_dense_prefix(sd.region_align_down(space->top()));
} else if (dead + free_at_end > free_target) {
// Find a dense prefix that makes the right amount of space available.
HeapWord* cur = sd.region_align_down(space->top());
HeapWord* cur_destination = sd.addr_to_region_ptr(cur)->destination();
size_t dead_to_right = pointer_delta(space->end(), cur_destination);
while (dead_to_right < free_target) {
cur -= region_size;
cur_destination = sd.addr_to_region_ptr(cur)->destination();
dead_to_right = pointer_delta(space->end(), cur_destination);
}
_space_info[id].set_dense_prefix(cur);
}
}
#endif // #ifndef PRODUCT
void PSParallelCompact::summarize_spaces_quick()
{
for (unsigned int i = 0; i < last_space_id; ++i) {
@ -1653,12 +1435,6 @@ void PSParallelCompact::summarize_spaces_quick()
assert(result, "space must fit into itself");
_space_info[i].set_dense_prefix(space->bottom());
}
#ifndef PRODUCT
if (ParallelOldGCSplitALot) {
provoke_split_fill_survivor(to_space_id);
}
#endif // #ifndef PRODUCT
}
void PSParallelCompact::fill_dense_prefix_end(SpaceId id)
@ -1743,8 +1519,7 @@ void
PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction)
{
assert(id < last_space_id, "id out of range");
assert(_space_info[id].dense_prefix() == _space_info[id].space()->bottom() ||
ParallelOldGCSplitALot && id == old_space_id,
assert(_space_info[id].dense_prefix() == _space_info[id].space()->bottom(),
"should have been reset in summarize_spaces_quick()");
const MutableSpace* space = _space_info[id].space();
@ -1864,11 +1639,6 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm,
// XXX - should also try to expand
maximum_compaction = true;
}
#ifndef PRODUCT
if (ParallelOldGCSplitALot && old_space_total_live < old_capacity) {
provoke_split(maximum_compaction);
}
#endif // #ifndef PRODUCT
// Old generations.
summarize_space(old_space_id, maximum_compaction);

View File

@ -1059,24 +1059,6 @@ class PSParallelCompact : AllStatic {
// Clear the summary data source_region field for the specified addresses.
static void clear_source_region(HeapWord* beg_addr, HeapWord* end_addr);
#ifndef PRODUCT
// Routines to provoke splitting a young gen space (ParallelOldGCSplitALot).
// Fill the region [start, start + words) with live object(s). Only usable
// for the old and permanent generations.
static void fill_with_live_objects(SpaceId id, HeapWord* const start,
size_t words);
// Include the new objects in the summary data.
static void summarize_new_objects(SpaceId id, HeapWord* start);
// Add live objects to a survivor space since it's rare that both survivors
// are non-empty.
static void provoke_split_fill_survivor(SpaceId id);
// Add live objects and/or choose the dense prefix to provoke splitting.
static void provoke_split(bool & maximum_compaction);
#endif
static void summarize_spaces_quick();
static void summarize_space(SpaceId id, bool maximum_compaction);
static void summary_phase(ParCompactionManager* cm, bool maximum_compaction);

View File

@ -297,11 +297,6 @@ bool PSScavenge::invoke_no_policy() {
young_gen->eden_space()->accumulate_statistics();
}
if (ZapUnusedHeapArea) {
// Save information needed to minimize mangling
heap->record_gen_tops_before_GC();
}
heap->print_heap_before_gc();
heap->trace_heap_before_gc(&_gc_tracer);
@ -344,13 +339,10 @@ bool PSScavenge::invoke_no_policy() {
CardTableExtension::verify_all_young_refs_imprecise();
}
if (!ScavengeWithObjectsInToSpace) {
assert(young_gen->to_space()->is_empty(),
"Attempt to scavenge with live objects in to_space");
young_gen->to_space()->clear(SpaceDecorator::Mangle);
} else if (ZapUnusedHeapArea) {
young_gen->to_space()->mangle_unused_area();
}
assert(young_gen->to_space()->is_empty(),
"Attempt to scavenge with live objects in to_space");
young_gen->to_space()->clear(SpaceDecorator::Mangle);
save_to_space_top_before_gc();
COMPILER2_PRESENT(DerivedPointerTable::clear());
@ -677,12 +669,6 @@ bool PSScavenge::invoke_no_policy() {
heap->print_heap_after_gc();
heap->trace_heap_after_gc(&_gc_tracer);
if (ZapUnusedHeapArea) {
young_gen->eden_space()->check_mangled_unused_area_complete();
young_gen->from_space()->check_mangled_unused_area_complete();
young_gen->to_space()->check_mangled_unused_area_complete();
}
scavenge_exit.update();
if (PrintGCTaskTimeStamps) {
@ -764,15 +750,13 @@ bool PSScavenge::should_attempt_scavenge() {
PSYoungGen* young_gen = heap->young_gen();
PSOldGen* old_gen = heap->old_gen();
if (!ScavengeWithObjectsInToSpace) {
// Do not attempt to promote unless to_space is empty
if (!young_gen->to_space()->is_empty()) {
_consecutive_skipped_scavenges++;
if (UsePerfData) {
counters->update_scavenge_skipped(to_space_not_empty);
}
return false;
// Do not attempt to promote unless to_space is empty
if (!young_gen->to_space()->is_empty()) {
_consecutive_skipped_scavenges++;
if (UsePerfData) {
counters->update_scavenge_skipped(to_space_not_empty);
}
return false;
}
// Test to see if the scavenge will likely fail.

View File

@ -2431,20 +2431,6 @@ bool Arguments::check_vm_args_consistency() {
MarkSweepAlwaysCompactCount = 1; // Move objects every gc.
}
if (UseParallelOldGC && ParallelOldGCSplitALot) {
// Settings to encourage splitting.
if (!FLAG_IS_CMDLINE(NewRatio)) {
if (FLAG_SET_CMDLINE(uintx, NewRatio, 2) != Flag::SUCCESS) {
status = false;
}
}
if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) {
if (FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false) != Flag::SUCCESS) {
status = false;
}
}
}
if (!(UseParallelGC || UseParallelOldGC) && FLAG_IS_DEFAULT(ScavengeBeforeFullGC)) {
FLAG_SET_DEFAULT(ScavengeBeforeFullGC, false);
}

View File

@ -1569,14 +1569,6 @@ public:
product(bool, TraceDynamicGCThreads, false, \
"Trace the dynamic GC thread usage") \
\
develop(bool, ParallelOldGCSplitALot, false, \
"Provoke splitting (copying data from a young gen space to " \
"multiple destination spaces)") \
\
develop(uintx, ParallelOldGCSplitInterval, 3, \
"How often to provoke splitting a young gen space") \
range(0, max_uintx) \
\
product(uint, ConcGCThreads, 0, \
"Number of threads concurrent gc will use") \
constraint(ConcGCThreadsConstraintFunc,AfterErgo) \
@ -1595,9 +1587,6 @@ public:
product(bool, ScavengeBeforeFullGC, true, \
"Scavenge youngest generation before each full GC.") \
\
develop(bool, ScavengeWithObjectsInToSpace, false, \
"Allow scavenges to occur when to-space contains objects") \
\
product(bool, UseConcMarkSweepGC, false, \
"Use Concurrent Mark-Sweep GC in the old generation") \
\
@ -2240,12 +2229,6 @@ public:
"Policy for changing generation size for throughput goals") \
range(0, 1) \
\
develop(bool, PSAdjustTenuredGenForMinorPause, false, \
"Adjust tenured generation to achieve a minor pause goal") \
\
develop(bool, PSAdjustYoungGenForMajorPause, false, \
"Adjust young generation to achieve a major pause goal") \
\
product(uintx, AdaptiveSizePolicyInitializingSteps, 20, \
"Number of steps where heuristics is used before data is used") \
\