Skip to content

Commit

Permalink
fix a bug where totalCPU count was being used for cachesize computati…
Browse files Browse the repository at this point in the history
…on (dotnet#83528)
  • Loading branch information
mangod9 committed Mar 16, 2023
1 parent a2b70f9 commit 5622342
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/coreclr/gc/unix/gcenv.unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ static size_t GetLogicalProcessorCacheSizeFromOS()
// Estimate cache size based on CPU count
// Assume lower core count are lighter weight parts which are likely to have smaller caches
// Assume L3$/CPU grows linearly from 256K to 1.5M/CPU as logicalCPUs grows from 2 to 12 CPUs
DWORD logicalCPUs = g_totalCpuCount;
DWORD logicalCPUs = g_processAffinitySet.Count();

cacheSize = logicalCPUs * std::min(1536, std::max(256, (int)logicalCPUs * 128)) * 1024;
}
Expand Down Expand Up @@ -903,7 +903,7 @@ static size_t GetLogicalProcessorCacheSizeFromOS()
// 5 ~ 16 : 8 MB
// 17 ~ 64 : 16 MB
// 65+ : 32 MB
DWORD logicalCPUs = g_totalCpuCount;
DWORD logicalCPUs = g_processAffinitySet.Count();
if (logicalCPUs < 5)
{
cacheSize = 4;
Expand Down

0 comments on commit 5622342

Please sign in to comment.