mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
7012980: PSOldGen is increased if there is no space in Metaspace
Reviewed-by: tschatzl, tbenson
This commit is contained in:
parent
bd52f0a2ef
commit
48ed80d136
6 changed files with 46 additions and 11 deletions
|
@ -130,8 +130,7 @@ void PSAdaptiveSizePolicy::major_collection_end(size_t amount_live,
|
||||||
// Update the pause time.
|
// Update the pause time.
|
||||||
_major_timer.stop();
|
_major_timer.stop();
|
||||||
|
|
||||||
if (!GCCause::is_user_requested_gc(gc_cause) ||
|
if (should_update_promo_stats(gc_cause)) {
|
||||||
UseAdaptiveSizePolicyWithSystemGC) {
|
|
||||||
double major_pause_in_seconds = _major_timer.seconds();
|
double major_pause_in_seconds = _major_timer.seconds();
|
||||||
double major_pause_in_ms = major_pause_in_seconds * MILLIUNITS;
|
double major_pause_in_ms = major_pause_in_seconds * MILLIUNITS;
|
||||||
|
|
||||||
|
|
|
@ -272,8 +272,7 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
|
||||||
// Don't check if the size_policy is ready here. Let
|
// Don't check if the size_policy is ready here. Let
|
||||||
// the size_policy check that internally.
|
// the size_policy check that internally.
|
||||||
if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
|
if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
|
||||||
(!GCCause::is_user_requested_gc(gc_cause) ||
|
AdaptiveSizePolicy::should_update_promo_stats(gc_cause)) {
|
||||||
UseAdaptiveSizePolicyWithSystemGC)) {
|
|
||||||
// Swap the survivor spaces if from_space is empty. The
|
// Swap the survivor spaces if from_space is empty. The
|
||||||
// resize_young_gen() called below is normally used after
|
// resize_young_gen() called below is normally used after
|
||||||
// a successful young GC and swapping of survivor spaces;
|
// a successful young GC and swapping of survivor spaces;
|
||||||
|
|
|
@ -2089,8 +2089,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
|
||||||
// Don't check if the size_policy is ready here. Let
|
// Don't check if the size_policy is ready here. Let
|
||||||
// the size_policy check that internally.
|
// the size_policy check that internally.
|
||||||
if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
|
if (UseAdaptiveGenerationSizePolicyAtMajorCollection &&
|
||||||
(!GCCause::is_user_requested_gc(gc_cause) ||
|
AdaptiveSizePolicy::should_update_promo_stats(gc_cause)) {
|
||||||
UseAdaptiveSizePolicyWithSystemGC)) {
|
|
||||||
// Swap the survivor spaces if from_space is empty. The
|
// Swap the survivor spaces if from_space is empty. The
|
||||||
// resize_young_gen() called below is normally used after
|
// resize_young_gen() called below is normally used after
|
||||||
// a successful young GC and swapping of survivor spaces;
|
// a successful young GC and swapping of survivor spaces;
|
||||||
|
|
|
@ -290,8 +290,7 @@ bool PSScavenge::invoke_no_policy() {
|
||||||
|
|
||||||
AdaptiveSizePolicyOutput(size_policy, heap->total_collections());
|
AdaptiveSizePolicyOutput(size_policy, heap->total_collections());
|
||||||
|
|
||||||
if (!GCCause::is_user_requested_gc(gc_cause) ||
|
if (AdaptiveSizePolicy::should_update_eden_stats(gc_cause)) {
|
||||||
UseAdaptiveSizePolicyWithSystemGC) {
|
|
||||||
// Gather the feedback data for eden occupancy.
|
// Gather the feedback data for eden occupancy.
|
||||||
young_gen->eden_space()->accumulate_statistics();
|
young_gen->eden_space()->accumulate_statistics();
|
||||||
}
|
}
|
||||||
|
@ -559,9 +558,7 @@ bool PSScavenge::invoke_no_policy() {
|
||||||
// Don't check if the size_policy is ready at this
|
// Don't check if the size_policy is ready at this
|
||||||
// level. Let the size_policy check that internally.
|
// level. Let the size_policy check that internally.
|
||||||
if (UseAdaptiveGenerationSizePolicyAtMinorCollection &&
|
if (UseAdaptiveGenerationSizePolicyAtMinorCollection &&
|
||||||
((gc_cause != GCCause::_java_lang_system_gc) ||
|
(AdaptiveSizePolicy::should_update_eden_stats(gc_cause))) {
|
||||||
UseAdaptiveSizePolicyWithSystemGC)) {
|
|
||||||
|
|
||||||
// Calculate optimal free space amounts
|
// Calculate optimal free space amounts
|
||||||
assert(young_gen->max_size() >
|
assert(young_gen->max_size() >
|
||||||
young_gen->from_space()->capacity_in_bytes() +
|
young_gen->from_space()->capacity_in_bytes() +
|
||||||
|
|
|
@ -487,6 +487,18 @@ class AdaptiveSizePolicy : public CHeapObj<mtGC> {
|
||||||
GCCause::Cause gc_cause,
|
GCCause::Cause gc_cause,
|
||||||
CollectorPolicy* collector_policy);
|
CollectorPolicy* collector_policy);
|
||||||
|
|
||||||
|
static bool should_update_promo_stats(GCCause::Cause cause) {
|
||||||
|
return ((GCCause::is_user_requested_gc(cause) &&
|
||||||
|
UseAdaptiveSizePolicyWithSystemGC) ||
|
||||||
|
GCCause::is_tenured_allocation_failure_gc(cause));
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool should_update_eden_stats(GCCause::Cause cause) {
|
||||||
|
return ((GCCause::is_user_requested_gc(cause) &&
|
||||||
|
UseAdaptiveSizePolicyWithSystemGC) ||
|
||||||
|
GCCause::is_allocation_failure_gc(cause));
|
||||||
|
}
|
||||||
|
|
||||||
// Printing support
|
// Printing support
|
||||||
virtual bool print_adaptive_size_policy_on(outputStream* st) const;
|
virtual bool print_adaptive_size_policy_on(outputStream* st) const;
|
||||||
bool print_adaptive_size_policy_on(outputStream* st,
|
bool print_adaptive_size_policy_on(outputStream* st,
|
||||||
|
|
|
@ -92,6 +92,35 @@ class GCCause : public AllStatic {
|
||||||
cause == GCCause::_heap_dump);
|
cause == GCCause::_heap_dump);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Causes for collection of the tenured gernation
|
||||||
|
inline static bool is_tenured_allocation_failure_gc(GCCause::Cause cause) {
|
||||||
|
assert(cause != GCCause::_old_generation_too_full_to_scavenge &&
|
||||||
|
cause != GCCause::_old_generation_expanded_on_last_scavenge,
|
||||||
|
err_msg("This GCCause may be correct but is not expected yet: %s",
|
||||||
|
to_string(cause)));
|
||||||
|
// _tenured_generation_full or _cms_generation_full for full tenured generations
|
||||||
|
// _adaptive_size_policy for a full collection after a young GC
|
||||||
|
// _allocation_failure is the generic cause a collection which could result
|
||||||
|
// in the collection of the tenured generation if there is not enough space
|
||||||
|
// in the tenured generation to support a young GC.
|
||||||
|
// _last_ditch_collection is a collection done to include SoftReferences.
|
||||||
|
return (cause == GCCause::_tenured_generation_full ||
|
||||||
|
cause == GCCause::_cms_generation_full ||
|
||||||
|
cause == GCCause::_adaptive_size_policy ||
|
||||||
|
cause == GCCause::_allocation_failure ||
|
||||||
|
cause == GCCause::_last_ditch_collection);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Causes for collection of the young generation
|
||||||
|
inline static bool is_allocation_failure_gc(GCCause::Cause cause) {
|
||||||
|
// _allocation_failure is the generic cause a collection for allocation failure
|
||||||
|
// _adaptive_size_policy is for a collecton done before a full GC
|
||||||
|
// _last_ditch_collection is a collection done to include SoftReferences.
|
||||||
|
return (cause == GCCause::_allocation_failure ||
|
||||||
|
cause == GCCause::_adaptive_size_policy ||
|
||||||
|
cause == GCCause::_last_ditch_collection);
|
||||||
|
}
|
||||||
|
|
||||||
// Return a string describing the GCCause.
|
// Return a string describing the GCCause.
|
||||||
static const char* to_string(GCCause::Cause cause);
|
static const char* to_string(GCCause::Cause cause);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue