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

Change heuristics for activating compilation threads #3139

Merged
merged 1 commit into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions runtime/compiler/control/CompilationThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,22 +388,23 @@ TR_YesNoMaybe TR::CompilationInfo::shouldActivateNewCompThread()
// determined based on the number of CPUs, then the upper bound of comp threads is _numTargetCPUs-1
// However, if the compilation threads are starved (on Linux) we may want
// to activate additional comp threads irrespective of the CPU entitlement
if (TR::Options::_useCPUsToDetermineMaxNumberOfCompThreadsToActivate ||
!_starvationDetected)
if (TR::Options::_useCPUsToDetermineMaxNumberOfCompThreadsToActivate)
{
if (getNumCompThreadsActive() >= getNumTargetCPUs() - 1)
if (getNumCompThreadsActive() < getNumTargetCPUs() - 1)
{
return TR_no;
if (_queueWeight > compThreadActivationThresholds[getNumCompThreadsActive()])
return TR_yes;
}
else
else if (_starvationDetected)
{
if (_queueWeight > compThreadActivationThresholds[getNumCompThreadsActive()])
// comp thread starvation; may activate threads beyond numCpu-1
if (_queueWeight > compThreadActivationThresholdsonStarvation[getNumCompThreadsActive()])
return TR_yes;
}
}
else // comp thread starvation; may activate threads beyond numCpu-1
else // number of compilation threads indicated by the user
{
if (_queueWeight > compThreadActivationThresholdsonStarvation[getNumCompThreadsActive()])
if (_queueWeight > compThreadActivationThresholds[getNumCompThreadsActive()])
return TR_yes;
}

Expand Down
19 changes: 10 additions & 9 deletions runtime/compiler/control/J9Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1990,22 +1990,23 @@ J9::Options::fePostProcessJIT(void * base)
//
if (_numUsableCompilationThreads <= 0)
{
#ifdef LINUX
// For linux we may want to create more threads to overcome thread
// starvation due to lack of priorities
//
if (!TR::Options::getCmdLineOptions()->getOption(TR_DisableRampupImprovements) &&
!TR::Options::getAOTCmdLineOptions()->getOption(TR_DisableRampupImprovements))
_numUsableCompilationThreads = MAX_USABLE_COMP_THREADS;
#endif // LINUX
_useCPUsToDetermineMaxNumberOfCompThreadsToActivate = true;
if (TR::Compiler->target.isLinux())
{
// For linux we may want to create more threads to overcome thread
// starvation due to lack of priorities
//
if (!TR::Options::getCmdLineOptions()->getOption(TR_DisableRampupImprovements) &&
!TR::Options::getAOTCmdLineOptions()->getOption(TR_DisableRampupImprovements))
_numUsableCompilationThreads = MAX_USABLE_COMP_THREADS;
}
if (_numUsableCompilationThreads <= 0)
{
// Determine the number of compilation threads based on number of online processors
// Do not create more than numProc-1 compilation threads, but at least one
//
uint32_t numOnlineCPUs = j9sysinfo_get_number_CPUs_by_type(J9PORT_CPU_ONLINE);
_numUsableCompilationThreads = numOnlineCPUs > 1 ? std::min((numOnlineCPUs - 1), static_cast<uint32_t>(MAX_USABLE_COMP_THREADS)) : 1;
_useCPUsToDetermineMaxNumberOfCompThreadsToActivate = true;
}
}

Expand Down