Use a lock per UnwindInfoTable object instead of global lock#125545
Use a lock per UnwindInfoTable object instead of global lock#125545eduardo-vp wants to merge 3 commits intodotnet:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates CoreCLR’s Windows x64 unwind-info publishing to reduce lock contention by moving from a single global lock to a per-UnwindInfoTable lock, improving scalability when multiple code heaps publish unwind data concurrently.
Changes:
- Add a per-table
Crst(m_lock) toUnwindInfoTable. - Use the global lock only for lazy initialization, and use the per-table lock for steady-state add/remove operations.
- Rework the slow-path growth to keep the
UnwindInfoTableobject stable (swap only the internalpTablearray).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/vm/codeman.h | Adds per-UnwindInfoTable lock member. |
| src/coreclr/vm/codeman.cpp | Switches add/remove synchronization to per-table locking and updates the growth path to swap arrays in-place. |
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Reduces lock contention in CoreCLR’s Windows x64 unwind info publishing by moving from a single global UnwindInfoTable lock to a per-table lock (one per code range / code heap).
Changes:
- Add a per-
UnwindInfoTableCrstto synchronize table updates independently per range. - Keep the global lock only for lazy initialization of the per-range
UnwindInfoTable. - Change table growth to preserve the
UnwindInfoTableobject (and its lock) while swapping the internalpTablearray.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/vm/codeman.h | Adds a per-table Crst member to UnwindInfoTable. |
| src/coreclr/vm/codeman.cpp | Uses global lock only for lazy init; uses per-table lock for add/remove and resizes by swapping pTable instead of replacing the object. |
You can also share your feedback on Copilot code review. Take the survey.
Will collect some numbers, in the meantime just checking for CI errors.