Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8204686: Dynamic parallel reference processing support for Parallel GC #4253

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1779,8 +1779,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 =
@@ -1789,8 +1788,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();
@@ -97,13 +97,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");
@@ -1319,12 +1317,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 @@ class ReferenceProcessor : public ReferenceDiscoverer {
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 @@ class ReferenceProcessor : public ReferenceDiscoverer {
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 @@ class ReferenceProcessor : public ReferenceDiscoverer {
// 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.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 static void main(String args[]) throws Exception {
}
if (GC.Parallel.isSupported()) {
noneGCSupported = false;
testFlag(new String[] { "-XX:+UseParallelGC" }, false);
testFlag(new String[] { "-XX:+UseParallelGC" }, true);
}
if (GC.G1.isSupported()) {
noneGCSupported = false;