Replace GCX_COOP with EBR for EEHashTable bucket reclamation#124822
Draft
AaronRobinsonMSFT wants to merge 1 commit intodotnet:mainfrom
Draft
Replace GCX_COOP with EBR for EEHashTable bucket reclamation#124822AaronRobinsonMSFT wants to merge 1 commit intodotnet:mainfrom
AaronRobinsonMSFT wants to merge 1 commit intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @agocke |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the prior GC cooperative-mode based scheme for safely reclaiming obsolete EEHashTable bucket arrays with Epoch-Based Reclamation (EBR), aligning EEHashTable resizing behavior with the earlier HashMap EBR work.
Changes:
- Add a dedicated global EBR collector (
g_EEHashEbr) and initialize it during EE startup; trigger cleanup from the finalizer thread’s “extra work” loop. - Refactor EEHashTable bucket allocation/freeing into helpers and use EBR critical regions + deferred deletion during table growth instead of
GCX_COOP_NO_THREAD_BROKEN+SyncClean. - Simplify
SyncCleanby removing the EEHashTable-specific cleanup list and related APIs.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/vm/syncclean.hpp | Removes EEHashTable cleanup list API; leaves SyncClean::CleanUp() only. |
| src/coreclr/vm/syncclean.cpp | Removes EEHashTable cleanup list storage and freeing logic. |
| src/coreclr/vm/finalizerthread.cpp | Adds g_EEHashEbr cleanup request detection and processing in finalizer extra-work path. |
| src/coreclr/vm/eehash.inl | Replaces COOP transitions with EBR critical regions; defers old bucket array deletion via EBR during growth. |
| src/coreclr/vm/eehash.h | Declares EEHashTable bucket allocation/free helpers. |
| src/coreclr/vm/eehash.cpp | Implements AllocateEEHashBuckets / FreeEEHashBuckets. |
| src/coreclr/vm/ebr.h | Declares extern EbrCollector g_EEHashEbr. |
| src/coreclr/vm/ebr.cpp | Defines global g_EEHashEbr. |
| src/coreclr/vm/ceemain.cpp | Initializes g_EEHashEbr during EE startup. |
Replace cooperative GC mode transitions (GCX_COOP_NO_THREAD_BROKEN) with Epoch-Based Reclamation for safe deferred deletion of old EEHashTable bucket arrays during resize. - Add dedicated g_EEHashEbr collector (init, cleanup, critical regions) - Add AllocateEEHashBuckets/FreeEEHashBuckets helpers in eehash.cpp - Remove SyncClean::AddEEHashTable and associated cleanup infrastructure - Remove redundant MemoryBarrier before VolatilePtr::Store (release semantics) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b4f6cb0 to
c8e7d2b
Compare
This was referenced Feb 25, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace cooperative GC mode transitions (
GCX_COOP_NO_THREAD_BROKEN) with Epoch-Based Reclamation for safe deferred deletion of oldEEHashTablebucket arrays during resize.Changes
g_EEHashEbrcollector (separate fromHashMap'sg_HashMapEbr), with initialization inceemain.cppand cleanup infinalizerthread.cppAllocateEEHashBucketsFreeEEHashBucketshelpers ineehash.cpp, following the same pattern asHashMap'sAllocateBucketsFreeBucketsSyncClean::AddEEHashTableand associated cleanup infrastructure fromsyncclean.cpp/.hppMemoryBarrier()beforeVolatilePtr::Store()— release semantics already provide the ordering guaranteeFollow-up to #124307 (Replace
HashMapCOOP transitions with EBR). Specifically see #124307 (comment).