Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/9.0] bgc deadlock fix #108774

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
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: 9 additions & 2 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25698,7 +25698,7 @@ void gc_heap::calculate_new_heap_count ()

dprintf (6666, ("we want to grow but DATAS is limiting, trigger a gen2 right away"));
#ifdef BACKGROUND_GC
if (background_running_p())
if (is_bgc_in_progress())
{
trigger_initial_gen2_p = false;
}
Expand Down Expand Up @@ -37858,7 +37858,14 @@ void gc_heap::allow_fgc()

BOOL gc_heap::is_bgc_in_progress()
{
return (background_running_p() || (current_bgc_state == bgc_initialized));
#ifdef MULTIPLE_HEAPS
// All heaps are changed to/from the bgc_initialized state during the VM suspension at the start of BGC,
// so checking any heap will work.
gc_heap* hp = g_heaps[0];
#else
gc_heap* hp = pGenGCHeap;
#endif //MULTIPLE_HEAPS
return (background_running_p() || (hp->current_bgc_state == bgc_initialized));
}

void gc_heap::clear_commit_flag()
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/gc/gcpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3265,7 +3265,7 @@ class gc_heap
// Restores BGC settings if necessary.
PER_HEAP_ISOLATED_METHOD void recover_bgc_settings();

PER_HEAP_METHOD BOOL is_bgc_in_progress();
PER_HEAP_ISOLATED_METHOD BOOL is_bgc_in_progress();

PER_HEAP_METHOD void clear_commit_flag();

Expand Down
Loading