From 234b07449a6473cc3b2ddeb2910179bcc44db95e Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Tue, 7 Apr 2020 23:35:41 -0700 Subject: [PATCH] Support 'System.GC.LargePages' in runtimeconfig.json (#34329) --- src/coreclr/src/inc/clrconfigvalues.h | 2 +- src/coreclr/src/vm/eeconfig.cpp | 10 +++++----- src/coreclr/src/vm/gcenv.ee.cpp | 6 ++++++ src/coreclr/src/vm/gcenv.ee.standalone.cpp | 1 + src/coreclr/src/vm/gcenv.ee.static.cpp | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/coreclr/src/inc/clrconfigvalues.h b/src/coreclr/src/inc/clrconfigvalues.h index fc711dc..fb643f4 100644 --- a/src/coreclr/src/inc/clrconfigvalues.h +++ b/src/coreclr/src/inc/clrconfigvalues.h @@ -315,7 +315,7 @@ RETAIL_CONFIG_STRING_INFO(EXTERNAL_GCName, W("GCName"), "") RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_GCHeapHardLimit, W("GCHeapHardLimit"), "Specifies the maximum commit size for the GC heap") RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_GCHeapHardLimitPercent, W("GCHeapHardLimitPercent"), "Specifies the GC heap usage as a percentage of the total memory") RETAIL_CONFIG_STRING_INFO(EXTERNAL_GCHeapAffinitizeRanges, W("GCHeapAffinitizeRanges"), "Specifies list of processors for Server GC threads. The format is a comma separated list of processor numbers or ranges of processor numbers. Example: 1,3,5,7-9,12") -RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_GCLargePages, W("GCLargePages"), "Specifies whether large pages should be used when a heap hard limit is set") +RETAIL_CONFIG_DWORD_INFO(EXTERNAL_GCLargePages, W("GCLargePages"), 0, "Specifies whether large pages should be used when a heap hard limit is set") /// /// IBC diff --git a/src/coreclr/src/vm/eeconfig.cpp b/src/coreclr/src/vm/eeconfig.cpp index c976380..7147136 100644 --- a/src/coreclr/src/vm/eeconfig.cpp +++ b/src/coreclr/src/vm/eeconfig.cpp @@ -480,16 +480,16 @@ fTrackDynamicMethodDebugInfo = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_ #endif bool gcConcurrentWasForced = false; - // The CLRConfig value for UNSUPPORTED_gcConcurrent defaults to -1, and treats any - // positive value as 'forcing' concurrent GC to be on. Because the standard logic - // for mapping a DWORD CLRConfig to a boolean configuration treats -1 as true (just - // like any other nonzero value), we will explicitly check the DWORD later if this - // check returns false. gcConcurrentWasForced = Configuration::GetKnobBooleanValue(W("System.GC.Concurrent"), false); int gcConcurrentConfigVal = 0; if (!gcConcurrentWasForced) { + // The CLRConfig value for UNSUPPORTED_gcConcurrent defaults to -1, and treats any + // positive value as 'forcing' concurrent GC to be on. Because the standard logic + // for mapping a DWORD CLRConfig to a boolean configuration treats -1 as true (just + // like any other nonzero value), we will explicitly check the DWORD later if this + // check returns false. gcConcurrentConfigVal = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_gcConcurrent); gcConcurrentWasForced = (gcConcurrentConfigVal > 0); } diff --git a/src/coreclr/src/vm/gcenv.ee.cpp b/src/coreclr/src/vm/gcenv.ee.cpp index 8352bb6..53566be 100644 --- a/src/coreclr/src/vm/gcenv.ee.cpp +++ b/src/coreclr/src/vm/gcenv.ee.cpp @@ -1049,6 +1049,12 @@ bool GCToEEInterface::GetBooleanConfigValue(const char* key, bool* value) return true; } + if (strcmp(key, "GCLargePages") == 0) + { + *value = Configuration::GetKnobBooleanValue(W("System.GC.LargePages"), CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_GCLargePages)); + return true; + } + WCHAR configKey[MaxConfigKeyLength]; if (MultiByteToWideChar(CP_ACP, 0, key, -1 /* key is null-terminated */, configKey, MaxConfigKeyLength) == 0) { diff --git a/src/coreclr/src/vm/gcenv.ee.standalone.cpp b/src/coreclr/src/vm/gcenv.ee.standalone.cpp index 5d6a58d..a52daea 100644 --- a/src/coreclr/src/vm/gcenv.ee.standalone.cpp +++ b/src/coreclr/src/vm/gcenv.ee.standalone.cpp @@ -15,6 +15,7 @@ #endif // FEATURE_COMINTEROP #include "gctoclreventsink.h" +#include "configuration.h" // the method table for the WeakReference class extern MethodTable* pWeakReferenceMT; diff --git a/src/coreclr/src/vm/gcenv.ee.static.cpp b/src/coreclr/src/vm/gcenv.ee.static.cpp index 697fed5b..b3802e5 100644 --- a/src/coreclr/src/vm/gcenv.ee.static.cpp +++ b/src/coreclr/src/vm/gcenv.ee.static.cpp @@ -15,6 +15,7 @@ #endif // FEATURE_COMINTEROP #include "gctoclreventsink.h" +#include "configuration.h" // the method table for the WeakReference class extern MethodTable* pWeakReferenceMT; -- 2.7.4