Skip to content
Merged
Changes from all 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
11 changes: 7 additions & 4 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ BOOL bgc_heap_walk_for_etw_p = FALSE;
#define LOH_PIN_DECAY 10

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 @@ -12728,6 +12729,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 @@ -43037,11 +43040,11 @@ size_t GCHeap::GetPromotedBytes(int heap_index)
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);
uint32_t saved_yp_spin_count_unit = yp_spin_count_unit;
yp_spin_count_unit = (uint32_t)((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