< prev index next >

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

Print this page
rev 52116 : 8212122: Allow ReferenceProcessor to always be MT processing


1355 
1356   if (use_max_threads(phase) || (ReferencesPerThread == 0)) {
1357     return max_threads;
1358   }
1359 
1360   size_t thread_count = 1 + (ref_count / ReferencesPerThread);
1361   return (uint)MIN3(thread_count,
1362                     static_cast<size_t>(max_threads),
1363                     (size_t)os::active_processor_count());
1364 }
1365 
1366 bool RefProcMTDegreeAdjuster::use_max_threads(RefProcPhases phase) const {
1367   // Even a small number of references in either of those cases could produce large amounts of work.
1368   return (phase == ReferenceProcessor::RefPhase1 || phase == ReferenceProcessor::RefPhase3);
1369 }
1370 
1371 RefProcMTDegreeAdjuster::RefProcMTDegreeAdjuster(ReferenceProcessor* rp,
1372                                                  RefProcPhases phase,
1373                                                  size_t ref_count):
1374     _rp(rp),
1375     _saved_mt_processing(_rp->processing_is_mt()),
1376     _saved_num_queues(_rp->num_queues()) {
1377   if (!_rp->processing_is_mt() || !_rp->adjust_no_of_processing_threads() || (ReferencesPerThread == 0)) {
1378     return;
1379   }
1380 
1381   uint workers = ergo_proc_thread_count(ref_count, _rp->num_queues(), phase);
1382 
1383   _rp->set_mt_processing(workers > 1);
1384   _rp->set_active_mt_degree(workers);
1385 }
1386 
1387 RefProcMTDegreeAdjuster::~RefProcMTDegreeAdjuster() {
1388   // Revert to previous status.
1389   _rp->set_mt_processing(_saved_mt_processing);
1390   _rp->set_active_mt_degree(_saved_num_queues);
1391 }


1355 
1356   if (use_max_threads(phase) || (ReferencesPerThread == 0)) {
1357     return max_threads;
1358   }
1359 
1360   size_t thread_count = 1 + (ref_count / ReferencesPerThread);
1361   return (uint)MIN3(thread_count,
1362                     static_cast<size_t>(max_threads),
1363                     (size_t)os::active_processor_count());
1364 }
1365 
1366 bool RefProcMTDegreeAdjuster::use_max_threads(RefProcPhases phase) const {
1367   // Even a small number of references in either of those cases could produce large amounts of work.
1368   return (phase == ReferenceProcessor::RefPhase1 || phase == ReferenceProcessor::RefPhase3);
1369 }
1370 
1371 RefProcMTDegreeAdjuster::RefProcMTDegreeAdjuster(ReferenceProcessor* rp,
1372                                                  RefProcPhases phase,
1373                                                  size_t ref_count):
1374     _rp(rp),

1375     _saved_num_queues(_rp->num_queues()) {
1376   if (!_rp->processing_is_mt() || !_rp->adjust_no_of_processing_threads() || (ReferencesPerThread == 0)) {
1377     return;
1378   }
1379 
1380   uint workers = ergo_proc_thread_count(ref_count, _rp->num_queues(), phase);
1381 

1382   _rp->set_active_mt_degree(workers);
1383 }
1384 
1385 RefProcMTDegreeAdjuster::~RefProcMTDegreeAdjuster() {
1386   // Revert to previous status.

1387   _rp->set_active_mt_degree(_saved_num_queues);
1388 }
< prev index next >