mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-04 07:28:22 +00:00
8320877: Shenandoah: Remove ShenandoahUnloadClassesFrequency support
Reviewed-by: wkemper, kdnilsen, rkennke
This commit is contained in:
parent
b68356b267
commit
b65ccff357
@ -38,12 +38,6 @@ ShenandoahAggressiveHeuristics::ShenandoahAggressiveHeuristics(ShenandoahSpaceIn
|
||||
|
||||
// Aggressive evacuates everything, so it needs as much evac space as it can get
|
||||
SHENANDOAH_ERGO_ENABLE_FLAG(ShenandoahEvacReserveOverflow);
|
||||
|
||||
// If class unloading is globally enabled, aggressive does unloading even with
|
||||
// concurrent cycles.
|
||||
if (ClassUnloading) {
|
||||
SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahUnloadClassesFrequency, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ShenandoahAggressiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset,
|
||||
@ -63,7 +57,7 @@ bool ShenandoahAggressiveHeuristics::should_start_gc() {
|
||||
}
|
||||
|
||||
bool ShenandoahAggressiveHeuristics::should_unload_classes() {
|
||||
if (!can_unload_classes_normal()) return false;
|
||||
if (!can_unload_classes()) return false;
|
||||
if (has_metaspace_oom()) return true;
|
||||
// Randomly unload classes with 50% chance.
|
||||
return (os::random() & 1) == 1;
|
||||
|
||||
@ -54,11 +54,6 @@ ShenandoahHeuristics::ShenandoahHeuristics(ShenandoahSpaceInfo* space_info) :
|
||||
_gc_time_history(new TruncatedSeq(10, ShenandoahAdaptiveDecayFactor)),
|
||||
_metaspace_oom()
|
||||
{
|
||||
// No unloading during concurrent mark? Communicate that to heuristics
|
||||
if (!ClassUnloadingWithConcurrentMark) {
|
||||
FLAG_SET_DEFAULT(ShenandoahUnloadClassesFrequency, 0);
|
||||
}
|
||||
|
||||
size_t num_regions = ShenandoahHeap::heap()->num_regions();
|
||||
assert(num_regions > 0, "Sanity");
|
||||
|
||||
@ -263,23 +258,10 @@ bool ShenandoahHeuristics::can_unload_classes() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShenandoahHeuristics::can_unload_classes_normal() {
|
||||
bool ShenandoahHeuristics::should_unload_classes() {
|
||||
if (!can_unload_classes()) return false;
|
||||
if (has_metaspace_oom()) return true;
|
||||
if (!ClassUnloadingWithConcurrentMark) return false;
|
||||
if (ShenandoahUnloadClassesFrequency == 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ShenandoahHeuristics::should_unload_classes() {
|
||||
if (!can_unload_classes_normal()) return false;
|
||||
if (has_metaspace_oom()) return true;
|
||||
size_t cycle = ShenandoahHeap::heap()->shenandoah_policy()->cycle_counter();
|
||||
// Unload classes every Nth GC cycle.
|
||||
// This should not happen in the same cycle as process_references to amortize costs.
|
||||
// Offsetting by one is enough to break the rendezvous when periods are equal.
|
||||
// When periods are not equal, offsetting by one is just as good as any other guess.
|
||||
return (cycle + 1) % ShenandoahUnloadClassesFrequency == 0;
|
||||
return ClassUnloadingWithConcurrentMark;
|
||||
}
|
||||
|
||||
void ShenandoahHeuristics::initialize() {
|
||||
|
||||
@ -130,7 +130,6 @@ public:
|
||||
virtual void choose_collection_set(ShenandoahCollectionSet* collection_set);
|
||||
|
||||
virtual bool can_unload_classes();
|
||||
virtual bool can_unload_classes_normal();
|
||||
virtual bool should_unload_classes();
|
||||
|
||||
virtual const char* name() = 0;
|
||||
|
||||
@ -76,11 +76,6 @@
|
||||
" compact - run GC more frequently and with deeper targets to " \
|
||||
"free up more memory.") \
|
||||
\
|
||||
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 " \
|
||||
"classes regardless. Set to zero to disable class unloading.") \
|
||||
\
|
||||
product(uintx, ShenandoahGarbageThreshold, 25, EXPERIMENTAL, \
|
||||
"How much garbage a region has to contain before it would be " \
|
||||
"taken for collection. This a guideline only, as GC heuristics " \
|
||||
|
||||
@ -140,14 +140,10 @@ public class TestClassLoaderLeak {
|
||||
|
||||
// Even when concurrent unloading is disabled, Full GC has to recover
|
||||
passWith("-XX:ShenandoahGCMode=" + mode, "-XX:ShenandoahGCHeuristics=" + h, "-XX:+ClassUnloading", "-XX:-ClassUnloadingWithConcurrentMark");
|
||||
passWith("-XX:ShenandoahGCMode=" + mode, "-XX:ShenandoahGCHeuristics=" + h, "-XX:+ClassUnloading", "-XX:-ClassUnloadingWithConcurrentMark", "-XX:ShenandoahUnloadClassesFrequency=0");
|
||||
passWith("-XX:ShenandoahGCMode=" + mode, "-XX:ShenandoahGCHeuristics=" + h, "-XX:+ClassUnloading", "-XX:+ClassUnloadingWithConcurrentMark", "-XX:ShenandoahUnloadClassesFrequency=0");
|
||||
|
||||
// Should OOME when unloading forcefully disabled, even if local flags try to enable it back
|
||||
failWith("-XX:ShenandoahGCMode=" + mode, "-XX:ShenandoahGCHeuristics=" + h, "-XX:-ClassUnloading");
|
||||
failWith("-XX:ShenandoahGCMode=" + mode, "-XX:ShenandoahGCHeuristics=" + h, "-XX:-ClassUnloading", "-XX:+ClassUnloadingWithConcurrentMark");
|
||||
failWith("-XX:ShenandoahGCMode=" + mode, "-XX:ShenandoahGCHeuristics=" + h, "-XX:-ClassUnloading", "-XX:+ClassUnloadingWithConcurrentMark", "-XX:ShenandoahUnloadClassesFrequency=1");
|
||||
failWith("-XX:ShenandoahGCMode=" + mode, "-XX:ShenandoahGCHeuristics=" + h, "-XX:-ClassUnloading", "-XX:-ClassUnloadingWithConcurrentMark", "-XX:ShenandoahUnloadClassesFrequency=1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user