8204686: Dynamic parallel reference processing support for Parallel GC

Reviewed-by: ayang, tschatzl, kbarrett
This commit is contained in:
Leo Korinth 2021-06-07 08:02:26 +00:00
parent 908aca29ca
commit 9fc914b963
6 changed files with 10 additions and 21 deletions

@ -1800,8 +1800,7 @@ void G1CollectedHeap::ref_processing_init() {
(ParallelGCThreads > 1) || (ConcGCThreads > 1), // mt discovery
MAX2(ParallelGCThreads, ConcGCThreads), // degree of mt discovery
false, // Reference discovery is not atomic
&_is_alive_closure_cm, // is alive closure
true); // allow changes to number of processing threads
&_is_alive_closure_cm); // is alive closure
// STW ref processor
_ref_processor_stw =
@ -1810,8 +1809,7 @@ void G1CollectedHeap::ref_processing_init() {
(ParallelGCThreads > 1), // mt discovery
ParallelGCThreads, // degree of mt discovery
true, // Reference discovery is atomic
&_is_alive_closure_stw, // is alive closure
true); // allow changes to number of processing threads
&_is_alive_closure_stw); // is alive closure
}
SoftRefPolicy* G1CollectedHeap::soft_ref_policy() {

@ -85,6 +85,10 @@ void ParallelArguments::initialize() {
if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
}
if (FLAG_IS_DEFAULT(ParallelRefProcEnabled) && ParallelGCThreads > 1) {
FLAG_SET_DEFAULT(ParallelRefProcEnabled, true);
}
}
// The alignment used for boundary between young gen and old gen

@ -805,8 +805,7 @@ void PSScavenge::initialize() {
true, // mt discovery
ParallelGCThreads, // mt discovery degree
true, // atomic_discovery
NULL, // header provides liveness info
false);
NULL); // header provides liveness info
// Cache the cardtable
_card_table = heap->card_table();

@ -98,13 +98,11 @@ ReferenceProcessor::ReferenceProcessor(BoolObjectClosure* is_subject_to_discover
bool mt_discovery,
uint mt_discovery_degree,
bool atomic_discovery,
BoolObjectClosure* is_alive_non_header,
bool adjust_no_of_processing_threads) :
BoolObjectClosure* is_alive_non_header) :
_is_subject_to_discovery(is_subject_to_discovery),
_discovering_refs(false),
_enqueuing_is_done(false),
_next_id(0),
_adjust_no_of_processing_threads(adjust_no_of_processing_threads),
_is_alive_non_header(is_alive_non_header)
{
assert(is_subject_to_discovery != NULL, "must be set");
@ -1320,12 +1318,7 @@ RefProcMTDegreeAdjuster::RefProcMTDegreeAdjuster(ReferenceProcessor* rp,
size_t ref_count):
_rp(rp),
_saved_num_queues(_rp->num_queues()) {
if (!_rp->adjust_no_of_processing_threads() || (ReferencesPerThread == 0)) {
return;
}
uint workers = ergo_proc_thread_count(ref_count, _rp->num_queues(), phase);
_rp->set_active_mt_degree(workers);
}

@ -206,7 +206,6 @@ private:
uint _next_id; // round-robin mod _num_queues counter in
// support of work distribution
bool _adjust_no_of_processing_threads; // allow dynamic adjustment of processing threads
// For collectors that do not keep GC liveness information
// in the object header, this field holds a closure that
// helps the reference processor determine the reachability
@ -368,8 +367,7 @@ public:
uint mt_processing_degree = 1,
bool mt_discovery = false, uint mt_discovery_degree = 1,
bool atomic_discovery = true,
BoolObjectClosure* is_alive_non_header = NULL,
bool adjust_no_of_processing_threads = false);
BoolObjectClosure* is_alive_non_header = NULL);
// RefDiscoveryPolicy values
enum DiscoveryPolicy {
@ -438,8 +436,6 @@ public:
// debugging
void verify_no_references_recorded() PRODUCT_RETURN;
void verify_referent(oop obj) PRODUCT_RETURN;
bool adjust_no_of_processing_threads() const { return _adjust_no_of_processing_threads; }
};
// A subject-to-discovery closure that uses a single memory span to determine the area that

@ -37,7 +37,6 @@ import java.util.Arrays;
import java.util.ArrayList;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jtreg.SkippedException;
import sun.hotspot.gc.GC;
@ -52,7 +51,7 @@ public class TestParallelRefProc {
}
if (GC.Parallel.isSupported()) {
noneGCSupported = false;
testFlag(new String[] { "-XX:+UseParallelGC" }, false);
testFlag(new String[] { "-XX:+UseParallelGC" }, true);
}
if (GC.G1.isSupported()) {
noneGCSupported = false;