fix a bug where totalCPU count was being used for cachesize computation (#83528)
authorManish Godse <61718172+mangod9@users.noreply.github.com>
Thu, 16 Mar 2023 21:46:36 +0000 (14:46 -0700)
committerGitHub <noreply@github.com>
Thu, 16 Mar 2023 21:46:36 +0000 (14:46 -0700)
src/coreclr/gc/unix/gcenv.unix.cpp

index cb32959c4ef34217913d60db2ac42f382f9bc96e..9590a9e73d00d3a52463f88fe0170cc9af5978fb 100644 (file)
@@ -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;