Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Factor out common logic for detecting high memory load.
  • Loading branch information
PeterSolMS authored and github-actions committed Sep 2, 2021
commit 437e1670023a31ec9d2288da86c012a423d248df
15 changes: 10 additions & 5 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10829,6 +10829,12 @@ int gc_heap::object_gennum_plan (uint8_t* o)
#pragma optimize("", on) // Go back to command line default optimizations
#endif //_MSC_VER && TARGET_X86

inline
bool high_memory_load_p()
{
return ((gc_heap::settings.entry_memory_load >= gc_heap::high_memory_load_th) || gc_heap::g_low_memory_status);
}

#ifdef USE_REGIONS
void get_initial_region(int gen, int hn, uint8_t** region_start, uint8_t** region_end)
{
Expand Down Expand Up @@ -10917,7 +10923,7 @@ void gc_heap::clear_region_info (heap_segment* region)
settings.gc_index, current_bgc_state,
seg_deleted);

if (settings.entry_memory_load >= high_memory_load_th || g_low_memory_status)
if (high_memory_load_p())
{
decommit_mark_array_by_seg (region);
}
Expand Down Expand Up @@ -11376,7 +11382,7 @@ size_t gc_heap::decommit_heap_segment_pages_worker (heap_segment* seg,
uint8_t* new_committed)
{
#ifdef USE_REGIONS
if (settings.entry_memory_load < high_memory_load_th && !g_low_memory_status)
if (!high_memory_load_p())
{
return 0;
}
Expand Down Expand Up @@ -11411,7 +11417,7 @@ size_t gc_heap::decommit_heap_segment_pages_worker (heap_segment* seg,
void gc_heap::decommit_heap_segment (heap_segment* seg)
{
#ifdef USE_REGIONS
if (settings.entry_memory_load < high_memory_load_th && !g_low_memory_status)
if (!high_memory_load_p())
{
return;
}
Expand Down Expand Up @@ -39354,8 +39360,7 @@ void reset_memory (uint8_t* o, size_t sizeo)
size_t size = align_lower_page ((size_t)o + sizeo - size_to_skip - plug_skew) - page_start;
// Note we need to compensate for an OS bug here. This bug would cause the MEM_RESET to fail
// on write watched memory.
if (reset_mm_p &&
((gc_heap::settings.entry_memory_load >= gc_heap::high_memory_load_th) || gc_heap::g_low_memory_status))
if (reset_mm_p && high_memory_load_p())
{
#ifdef MULTIPLE_HEAPS
bool unlock_p = true;
Expand Down