From 56223423e5f81264371b76ab9476229716df8d91 Mon Sep 17 00:00:00 2001 From: Manish Godse <61718172+mangod9@users.noreply.github.com> Date: Thu, 16 Mar 2023 14:46:36 -0700 Subject: [PATCH] fix a bug where totalCPU count was being used for cachesize computation (#83528) --- src/coreclr/gc/unix/gcenv.unix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/gc/unix/gcenv.unix.cpp b/src/coreclr/gc/unix/gcenv.unix.cpp index cb32959c4ef..9590a9e73d0 100644 --- a/src/coreclr/gc/unix/gcenv.unix.cpp +++ b/src/coreclr/gc/unix/gcenv.unix.cpp @@ -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; } @@ -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; -- 2.34.1