From 100f70f76c30c0b57c1b7cf2d91fda8ddf14b796 Mon Sep 17 00:00:00 2001 From: Aleksandar Micic Date: Thu, 30 Jan 2025 15:30:55 -0500 Subject: [PATCH] gcthreads adaptive fix with overloaded max count In a rare scenario, if a user specifies max GC thread count above h/w available thread count, adaptive threading math would incorrectly disregard the current h/w thread count. This fix makes adaptive threading math apply its logic on top of taskActiveThreadCount rather than _threadCount. It is more correct since the former not already accounts for the latter (_threadCount, what is currently spawned count of GC threads) but also accounts for _activeThreadCount which in turn has been adjusted to account of the number of h/w available threads. Signed-off-by: Aleksandar Micic --- gc/base/ParallelDispatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gc/base/ParallelDispatcher.cpp b/gc/base/ParallelDispatcher.cpp index 04ddd92487..f1e358b066 100644 --- a/gc/base/ParallelDispatcher.cpp +++ b/gc/base/ParallelDispatcher.cpp @@ -478,7 +478,7 @@ MM_ParallelDispatcher::recomputeActiveThreadCountForTask(MM_EnvironmentBase *env /* Bound the recommended thread count. Determine the upper bound for the thread count, * This will either be the user specified gcMaxThreadCount (-XgcmaxthreadsN) or else default max */ - taskActiveThreadCount = OMR_MIN(_threadCount, task->getRecommendedWorkingThreads()); + taskActiveThreadCount = OMR_MIN(taskActiveThreadCount, task->getRecommendedWorkingThreads()); _activeThreadCount = taskActiveThreadCount;