8203319: JDK-8201487 disabled too much queue balancing

Sometimes ignore ParallelRefProcBalancingEnabled.

Reviewed-by: tschatzl, sjohanss
This commit is contained in:
Kim Barrett 2018-06-05 09:15:03 -04:00
parent 8afe86a2fe
commit 056f7b3bd8
2 changed files with 25 additions and 2 deletions

@ -592,6 +592,28 @@ void ReferenceProcessor::set_active_mt_degree(uint v) {
_next_id = 0;
}
bool ReferenceProcessor::need_balance_queues(DiscoveredList refs_lists[]) {
assert(_processing_is_mt, "why balance non-mt processing?");
// _num_queues is the processing degree. Only list entries up to
// _num_queues will be processed, so any non-empty lists beyond
// that must be redistributed to lists in that range. Even if not
// needed for that, balancing may be desirable to eliminate poor
// distribution of references among the lists.
if (ParallelRefProcBalancingEnabled) {
return true; // Configuration says do it.
} else {
// Configuration says don't balance, but if there are non-empty
// lists beyond the processing degree, then must ignore the
// configuration and balance anyway.
for (uint i = _num_queues; i < _max_num_queues; ++i) {
if (!refs_lists[i].is_empty()) {
return true; // Must balance despite configuration.
}
}
return false; // Safe to obey configuration and not balance.
}
}
// Balances reference queues.
// Move entries from all queues[0, 1, ..., _max_num_q-1] to
// queues[0, 1, ..., _num_q-1] because only the first _num_q
@ -690,7 +712,7 @@ void ReferenceProcessor::process_discovered_reflist(
phase_times->set_processing_is_mt(mt_processing);
if (mt_processing && ParallelRefProcBalancingEnabled) {
if (mt_processing && need_balance_queues(refs_lists)) {
RefProcBalanceQueuesTimeTracker tt(phase_times);
balance_queues(refs_lists);
}

@ -320,7 +320,8 @@ private:
void log_reflist_counts(DiscoveredList ref_lists[], uint num_active_queues) PRODUCT_RETURN;
// Balances reference queues.
void balance_queues(DiscoveredList ref_lists[]);
void balance_queues(DiscoveredList refs_lists[]);
bool need_balance_queues(DiscoveredList refs_lists[]);
// Update (advance) the soft ref master clock field.
void update_soft_ref_master_clock();