Skip to content

Commit

Permalink
8266073: Regression ~2% in Derby after 8261804
Browse files Browse the repository at this point in the history
Reviewed-by: ayang, sjohanss
  • Loading branch information
lkorinth committed May 17, 2021
1 parent 02f895c commit f422787
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
13 changes: 6 additions & 7 deletions src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1562,15 +1562,9 @@ void G1ConcurrentMark::weak_refs_work(bool clear_all_soft_refs) {
// is not multi-threaded we use the current (VMThread) thread,
// otherwise we use the work gang from the G1CollectedHeap and
// we utilize all the worker threads we can.
bool processing_is_mt = rp->processing_is_mt();
uint active_workers = (processing_is_mt ? _g1h->workers()->active_workers() : 1U);
uint active_workers = (ParallelRefProcEnabled ? _g1h->workers()->active_workers() : 1U);
active_workers = clamp(active_workers, 1u, _max_num_tasks);

// Parallel processing task executor.
G1CMRefProcTaskExecutor par_task_executor(_g1h, this,
_g1h->workers(), active_workers);
AbstractRefProcTaskExecutor* executor = (processing_is_mt ? &par_task_executor : NULL);

// Set the concurrency level. The phase was already set prior to
// executing the remark task.
set_concurrency(active_workers);
Expand All @@ -1581,6 +1575,11 @@ void G1ConcurrentMark::weak_refs_work(bool clear_all_soft_refs) {
// Reference lists are balanced (see balance_all_queues() and balance_queues()).
rp->set_active_mt_degree(active_workers);

// Parallel processing task executor.
G1CMRefProcTaskExecutor par_task_executor(_g1h, this,
_g1h->workers(), active_workers);
AbstractRefProcTaskExecutor* executor = (rp->processing_is_mt() ? &par_task_executor : NULL);

ReferenceProcessorPhaseTimes pt(_gc_timer_cm, rp->max_num_queues());

// Process the weak references.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,11 @@ G1FullGCReferenceProcessingExecutor::G1FullGCReferenceProcessingExecutor(G1FullC
_collector(collector),
_reference_processor(collector->reference_processor()),
_old_mt_degree(_reference_processor->num_queues()) {
if (_reference_processor->processing_is_mt()) {
_reference_processor->set_active_mt_degree(_collector->workers());
}
_reference_processor->set_active_mt_degree(_collector->workers());
}

G1FullGCReferenceProcessingExecutor::~G1FullGCReferenceProcessingExecutor() {
if (_reference_processor->processing_is_mt()) {
_reference_processor->set_active_mt_degree(_old_mt_degree);
}
_reference_processor->set_active_mt_degree(_old_mt_degree);
}

G1FullGCReferenceProcessingExecutor::G1RefProcTaskProxy::G1RefProcTaskProxy(ProcessTask& proc_task,
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/gc/parallel/psParallelCompact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2125,9 +2125,8 @@ void PSParallelCompact::marking_phase(ParCompactionManager* cm,
ReferenceProcessorStats stats;
ReferenceProcessorPhaseTimes pt(&_gc_timer, ref_processor()->max_num_queues());

ref_processor()->set_active_mt_degree(active_gc_threads);
if (ref_processor()->processing_is_mt()) {
ref_processor()->set_active_mt_degree(active_gc_threads);

RefProcTaskExecutor task_executor;
stats = ref_processor()->process_discovered_references(
is_alive_closure(), &mark_and_push_closure, &follow_stack_closure,
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shared/referenceProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ RefProcMTDegreeAdjuster::RefProcMTDegreeAdjuster(ReferenceProcessor* rp,
size_t ref_count):
_rp(rp),
_saved_num_queues(_rp->num_queues()) {
if (!_rp->processing_is_mt() || !_rp->adjust_no_of_processing_threads() || (ReferencesPerThread == 0)) {
if (!_rp->adjust_no_of_processing_threads() || (ReferencesPerThread == 0)) {
return;
}

Expand Down

1 comment on commit f422787

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.