Skip to content
Merged
Changes from 2 commits
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
9 changes: 6 additions & 3 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ BOOL bgc_heap_walk_for_etw_p = FALSE;
#define UOH_ALLOCATION_RETRY_MAX_COUNT 2

uint32_t yp_spin_count_unit = 0;
uint32_t original_spin_count_unit = 0;
size_t loh_size_threshold = LARGE_OBJECT_SIZE;

#ifdef GC_CONFIG_DRIVEN
Expand Down Expand Up @@ -13218,6 +13219,8 @@ HRESULT gc_heap::initialize_gc (size_t soh_segment_size,
yp_spin_count_unit = 32 * g_num_processors;
#endif //MULTIPLE_HEAPS

original_spin_count_unit = yp_spin_count_unit;

#if defined(__linux__)
GCToEEInterface::UpdateGCEventStatus(static_cast<int>(GCEventStatus::GetEnabledLevel(GCEventProvider_Default)),
static_cast<int>(GCEventStatus::GetEnabledKeywords(GCEventProvider_Default)),
Expand Down Expand Up @@ -44301,10 +44304,10 @@ void GCHeap::SetYieldProcessorScalingFactor (float scalingFactor)
{
assert (yp_spin_count_unit != 0);
int saved_yp_spin_count_unit = yp_spin_count_unit;
yp_spin_count_unit = (int)((float)yp_spin_count_unit * scalingFactor / (float)9);
yp_spin_count_unit = (int)((float)original_spin_count_unit * scalingFactor / (float)9);

// It's very suspicious if it becomes 0
if (yp_spin_count_unit == 0)
// It's very suspicious if it becomes 0 and also, we don't want to spin too much.
if ((yp_spin_count_unit == 0) || (yp_spin_count_unit > 32768))
{
yp_spin_count_unit = saved_yp_spin_count_unit;
}
Expand Down