Skip to content

Commit

Permalink
Update heap hard limit for large pages (#81292)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Au <andrewau@microsoft.com>
  • Loading branch information
github-actions[bot] and cshung committed Feb 9, 2023
1 parent ce46be3 commit 598f976
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13691,10 +13691,20 @@ HRESULT gc_heap::initialize_gc (size_t soh_segment_size,
if (!reserve_initial_memory (soh_segment_size, loh_segment_size, poh_segment_size, number_of_heaps,
use_large_pages_p, separated_poh_p, heap_no_to_numa_node))
return E_OUTOFMEMORY;
if (separated_poh_p)
if (use_large_pages_p)
{
heap_hard_limit_oh[poh] = min_segment_size_hard_limit * number_of_heaps;
heap_hard_limit += heap_hard_limit_oh[poh];
if (heap_hard_limit_oh[soh])
{
heap_hard_limit_oh[soh] = soh_segment_size * number_of_heaps;
heap_hard_limit_oh[loh] = loh_segment_size * number_of_heaps;
heap_hard_limit_oh[poh] = poh_segment_size * number_of_heaps;
heap_hard_limit = heap_hard_limit_oh[soh] + heap_hard_limit_oh[loh] + heap_hard_limit_oh[poh];
}
else
{
assert (heap_hard_limit);
heap_hard_limit = (soh_segment_size + loh_segment_size + poh_segment_size) * number_of_heaps;
}
}
#endif //USE_REGIONS

Expand Down Expand Up @@ -45153,10 +45163,6 @@ HRESULT GCHeap::Initialize()

#endif //HOST_64BIT
GCConfig::SetGCLargePages(gc_heap::use_large_pages_p);
GCConfig::SetGCHeapHardLimit(static_cast<int64_t>(gc_heap::heap_hard_limit));
GCConfig::SetGCHeapHardLimitSOH(static_cast<int64_t>(gc_heap::heap_hard_limit_oh[soh]));
GCConfig::SetGCHeapHardLimitLOH(static_cast<int64_t>(gc_heap::heap_hard_limit_oh[loh]));
GCConfig::SetGCHeapHardLimitPOH(static_cast<int64_t>(gc_heap::heap_hard_limit_oh[poh]));

uint32_t nhp = 1;
uint32_t nhp_from_config = 0;
Expand Down Expand Up @@ -45341,6 +45347,11 @@ HRESULT GCHeap::Initialize()
hr = gc_heap::initialize_gc (seg_size, large_seg_size, pin_seg_size);
#endif //MULTIPLE_HEAPS

GCConfig::SetGCHeapHardLimit(static_cast<int64_t>(gc_heap::heap_hard_limit));
GCConfig::SetGCHeapHardLimitSOH(static_cast<int64_t>(gc_heap::heap_hard_limit_oh[soh]));
GCConfig::SetGCHeapHardLimitLOH(static_cast<int64_t>(gc_heap::heap_hard_limit_oh[loh]));
GCConfig::SetGCHeapHardLimitPOH(static_cast<int64_t>(gc_heap::heap_hard_limit_oh[poh]));

if (hr != S_OK)
return hr;

Expand Down

0 comments on commit 598f976

Please sign in to comment.