diff options
author | Andrew Au <andrewau@microsoft.com> | 2021-04-08 19:49:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-08 19:49:13 +0300 |
commit | d1111e5633dc5c12bc26633bf8bb6dd2f2499527 (patch) | |
tree | f8ed2a56ee4a2517c0f16f08908ad6524b3430a8 /src/coreclr/gc | |
parent | d927fcbb36131b8962d77d9f01bb3c6112072b95 (diff) |
Make some region parameters configurable (#50603)
Diffstat (limited to 'src/coreclr/gc')
-rw-r--r-- | src/coreclr/gc/gc.cpp | 7 | ||||
-rw-r--r-- | src/coreclr/gc/gcconfig.h | 3 | ||||
-rw-r--r-- | src/coreclr/gc/gcpriv.h | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 8df0a785859..77da3674319 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -40344,7 +40344,12 @@ HRESULT GCHeap::Initialize() #ifdef MULTIPLE_HEAPS gc_heap::soh_segment_size /= 4; #endif //MULTIPLE_HEAPS - gc_heap::min_segment_size_shr = index_of_highest_set_bit (REGION_SIZE); + size_t gc_region_size = (size_t)GCConfig::GetGCRegionsSize(); + if (!power_of_two_p(gc_region_size) || ((gc_region_size * nhp * 19) > gc_heap::regions_range)) + { + return E_INVALIDARG; + } + gc_heap::min_segment_size_shr = index_of_highest_set_bit (gc_region_size); #else gc_heap::min_segment_size_shr = index_of_highest_set_bit (gc_heap::min_segment_size); #endif //USE_REGIONS diff --git a/src/coreclr/gc/gcconfig.h b/src/coreclr/gc/gcconfig.h index e7b5e1f2180..0ab210bf48c 100644 --- a/src/coreclr/gc/gcconfig.h +++ b/src/coreclr/gc/gcconfig.h @@ -102,7 +102,8 @@ public: INT_CONFIG (GCHeapHardLimit, "GCHeapHardLimit", "System.GC.HeapHardLimit", 0, "Specifies a hard limit for the GC heap") \ INT_CONFIG (GCHeapHardLimitPercent, "GCHeapHardLimitPercent", "System.GC.HeapHardLimitPercent", 0, "Specifies the GC heap usage as a percentage of the total memory") \ INT_CONFIG (GCTotalPhysicalMemory, "GCTotalPhysicalMemory", NULL, 0, "Specifies what the GC should consider to be total physical memory") \ - INT_CONFIG (GCRegionsRange, "GCRegionsRange", NULL, 0, "Specifies the range for the GC heap") \ + INT_CONFIG (GCRegionsRange, "GCRegionsRange", NULL, 274877906944L, "Specifies the range for the GC heap") \ + INT_CONFIG (GCRegionsSize, "GCRegionsSize", NULL, 4194304, "Specifies the size for a basic GC region") \ STRING_CONFIG(LogFile, "GCLogFile", NULL, "Specifies the name of the GC log file") \ STRING_CONFIG(ConfigLogFile, "GCConfigLogFile", NULL, "Specifies the name of the GC config log file") \ INT_CONFIG (BGCFLTuningEnabled, "BGCFLTuningEnabled", NULL, 0, "Enables FL tuning") \ diff --git a/src/coreclr/gc/gcpriv.h b/src/coreclr/gc/gcpriv.h index f8455ac323c..1cfc2f229ac 100644 --- a/src/coreclr/gc/gcpriv.h +++ b/src/coreclr/gc/gcpriv.h @@ -5278,8 +5278,6 @@ public: // and free_large_regions. These decommitted regions will be returned to region_allocator which // mark the space as free blocks. // -// Make configs available to change these. -#define REGION_SIZE ((size_t)4 * 1024 * 1024) #define LARGE_REGION_FACTOR (8) #define region_alloc_free_bit (1 << (sizeof (uint32_t) * 8 - 1)) |