Skip to content

Commit

Permalink
Only apply cpu pinning when the threadpool is used (i.e. headless and…
Browse files Browse the repository at this point in the history
… legacy only)
  • Loading branch information
lostsquirrel1 committed Feb 14, 2025
1 parent a541d6d commit a1e6d64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rts/System/Platform/Threading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ namespace Threading {
//
// This doesn't preclude systems from using separate unpinned threads, which the OS should logically try to
// move to under used resources, such as low-power cores for example.
return pm.performanceCoreMask & (~pm.hyperThreadHighMask);
#if defined(THREADPOOL)
uint32_t policy = pm.performanceCoreMask & (~pm.hyperThreadHighMask);
#else
uint32_t policy = pm.performanceCoreMask | pm.efficiencyCoreMask;
#endif

return policy;
}

std::uint32_t GetAffinity()
Expand Down
3 changes: 3 additions & 0 deletions rts/System/Threading/ThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ void SetMaximumThreadCount()

void SetDefaultThreadCount()
{
#if !defined(THREADPOOL)
return;
#endif
std::uint32_t systemCores = Threading::GetSystemAffinityMask();
std::uint32_t mainAffinity = systemCores;

Expand Down

0 comments on commit a1e6d64

Please sign in to comment.