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

Add System.Threading.Thread.UseAllCpuGroups runtimeconfig switch #90360

Closed
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
2 changes: 1 addition & 1 deletion src/coreclr/utilcode/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ DWORD LCM(DWORD u, DWORD v)
if (m_nGroups > 1)
{
m_enableGCCPUGroups = TRUE;
m_threadUseAllCpuGroups = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_Thread_UseAllCpuGroups, groupCount > 1) != 0;
m_threadUseAllCpuGroups = Configuration::GetKnobBooleanValue(W("System.Threading.Thread.UseAllCpuGroups"), CLRConfig::EXTERNAL_Thread_UseAllCpuGroups, groupCount > 1) != 0;
m_threadAssignCpuGroups = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_Thread_AssignCpuGroups) != 0;

// Save the processor group affinity of the initial thread
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/comthreadpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ FCIMPL4(INT32, ThreadPoolNative::GetNextConfigUInt32Value,
case 18: if (TryGetConfig(CLRConfig::INTERNAL_HillClimbing_SampleIntervalHigh, false, W("System.Threading.ThreadPool.HillClimbing.SampleIntervalHigh"))) { return 19; } FALLTHROUGH;
case 19: if (TryGetConfig(CLRConfig::INTERNAL_HillClimbing_GainExponent, false, W("System.Threading.ThreadPool.HillClimbing.GainExponent"))) { return 20; } FALLTHROUGH;

case 20: if (TryGetConfig(CLRConfig::EXTERNAL_Thread_UseAllCpuGroups, false, W("System.Threading.Thread.UseAllCpuGroups"))) { return 21; } FALLTHROUGH;
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to it here? The threadpool should not care about CPU groups.

Also, this setting has complicated interactions with the OS defaults and the GC configuration. Reading the setting alone won't tell you much about whether the CPU groups are enabled or not.

Copy link
Member

Choose a reason for hiding this comment

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

It may be useful to submit a parallel doc PR to update the documentation to make sure that we like behavior of this switch. The behavior is not documented properly today: https://learn.microsoft.com/en-us/dotnet/core/runtime-config/threading#cpu-groups. The default depends on the Windows OS version and this settings takes effect only when the CPU groups are enable for the GC.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

This is the only CLRConfig::EXTERNAL_ translated here. Seems unlikely to be needed.


default:
*configValueRef = 0;
*isBooleanRef = false;
Expand Down