Skip to content

Commit 9fc914b

Browse files
committed
8204686: Dynamic parallel reference processing support for Parallel GC
Reviewed-by: ayang, tschatzl, kbarrett
1 parent 908aca2 commit 9fc914b

File tree

6 files changed

+10
-21
lines changed

6 files changed

+10
-21
lines changed

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,8 +1800,7 @@ void G1CollectedHeap::ref_processing_init() {
18001800
(ParallelGCThreads > 1) || (ConcGCThreads > 1), // mt discovery
18011801
MAX2(ParallelGCThreads, ConcGCThreads), // degree of mt discovery
18021802
false, // Reference discovery is not atomic
1803-
&_is_alive_closure_cm, // is alive closure
1804-
true); // allow changes to number of processing threads
1803+
&_is_alive_closure_cm); // is alive closure
18051804

18061805
// STW ref processor
18071806
_ref_processor_stw =
@@ -1810,8 +1809,7 @@ void G1CollectedHeap::ref_processing_init() {
18101809
(ParallelGCThreads > 1), // mt discovery
18111810
ParallelGCThreads, // degree of mt discovery
18121811
true, // Reference discovery is atomic
1813-
&_is_alive_closure_stw, // is alive closure
1814-
true); // allow changes to number of processing threads
1812+
&_is_alive_closure_stw); // is alive closure
18151813
}
18161814

18171815
SoftRefPolicy* G1CollectedHeap::soft_ref_policy() {

src/hotspot/share/gc/parallel/parallelArguments.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ void ParallelArguments::initialize() {
8585
if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
8686
FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
8787
}
88+
89+
if (FLAG_IS_DEFAULT(ParallelRefProcEnabled) && ParallelGCThreads > 1) {
90+
FLAG_SET_DEFAULT(ParallelRefProcEnabled, true);
91+
}
8892
}
8993

9094
// The alignment used for boundary between young gen and old gen

src/hotspot/share/gc/parallel/psScavenge.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,7 @@ void PSScavenge::initialize() {
805805
true, // mt discovery
806806
ParallelGCThreads, // mt discovery degree
807807
true, // atomic_discovery
808-
NULL, // header provides liveness info
809-
false);
808+
NULL); // header provides liveness info
810809

811810
// Cache the cardtable
812811
_card_table = heap->card_table();

src/hotspot/share/gc/shared/referenceProcessor.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,11 @@ ReferenceProcessor::ReferenceProcessor(BoolObjectClosure* is_subject_to_discover
9898
bool mt_discovery,
9999
uint mt_discovery_degree,
100100
bool atomic_discovery,
101-
BoolObjectClosure* is_alive_non_header,
102-
bool adjust_no_of_processing_threads) :
101+
BoolObjectClosure* is_alive_non_header) :
103102
_is_subject_to_discovery(is_subject_to_discovery),
104103
_discovering_refs(false),
105104
_enqueuing_is_done(false),
106105
_next_id(0),
107-
_adjust_no_of_processing_threads(adjust_no_of_processing_threads),
108106
_is_alive_non_header(is_alive_non_header)
109107
{
110108
assert(is_subject_to_discovery != NULL, "must be set");
@@ -1320,12 +1318,7 @@ RefProcMTDegreeAdjuster::RefProcMTDegreeAdjuster(ReferenceProcessor* rp,
13201318
size_t ref_count):
13211319
_rp(rp),
13221320
_saved_num_queues(_rp->num_queues()) {
1323-
if (!_rp->adjust_no_of_processing_threads() || (ReferencesPerThread == 0)) {
1324-
return;
1325-
}
1326-
13271321
uint workers = ergo_proc_thread_count(ref_count, _rp->num_queues(), phase);
1328-
13291322
_rp->set_active_mt_degree(workers);
13301323
}
13311324

src/hotspot/share/gc/shared/referenceProcessor.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ class ReferenceProcessor : public ReferenceDiscoverer {
206206
uint _next_id; // round-robin mod _num_queues counter in
207207
// support of work distribution
208208

209-
bool _adjust_no_of_processing_threads; // allow dynamic adjustment of processing threads
210209
// For collectors that do not keep GC liveness information
211210
// in the object header, this field holds a closure that
212211
// helps the reference processor determine the reachability
@@ -368,8 +367,7 @@ class ReferenceProcessor : public ReferenceDiscoverer {
368367
uint mt_processing_degree = 1,
369368
bool mt_discovery = false, uint mt_discovery_degree = 1,
370369
bool atomic_discovery = true,
371-
BoolObjectClosure* is_alive_non_header = NULL,
372-
bool adjust_no_of_processing_threads = false);
370+
BoolObjectClosure* is_alive_non_header = NULL);
373371

374372
// RefDiscoveryPolicy values
375373
enum DiscoveryPolicy {
@@ -438,8 +436,6 @@ class ReferenceProcessor : public ReferenceDiscoverer {
438436
// debugging
439437
void verify_no_references_recorded() PRODUCT_RETURN;
440438
void verify_referent(oop obj) PRODUCT_RETURN;
441-
442-
bool adjust_no_of_processing_threads() const { return _adjust_no_of_processing_threads; }
443439
};
444440

445441
// A subject-to-discovery closure that uses a single memory span to determine the area that

test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import java.util.ArrayList;
3838

3939
import jdk.test.lib.process.OutputAnalyzer;
40-
import jdk.test.lib.process.ProcessTools;
4140

4241
import jtreg.SkippedException;
4342
import sun.hotspot.gc.GC;
@@ -52,7 +51,7 @@ public static void main(String args[]) throws Exception {
5251
}
5352
if (GC.Parallel.isSupported()) {
5453
noneGCSupported = false;
55-
testFlag(new String[] { "-XX:+UseParallelGC" }, false);
54+
testFlag(new String[] { "-XX:+UseParallelGC" }, true);
5655
}
5756
if (GC.G1.isSupported()) {
5857
noneGCSupported = false;

0 commit comments

Comments
 (0)