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

Lock region allocator #49990

Merged
merged 37 commits into from
Mar 26, 2021
Merged

Lock region allocator #49990

merged 37 commits into from
Mar 26, 2021

Conversation

PeterSolMS
Copy link
Contributor

Make region_allocator multi-thread safe by wrapping a dedicated lock around region_allocator::allocate and region_allocator:delete_region. Added a few ASSERT_HOLDING_SPIN_LOCK to guard against future bitrot.

@ghost
Copy link

ghost commented Mar 22, 2021

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Issue Details

Make region_allocator multi-thread safe by wrapping a dedicated lock around region_allocator::allocate and region_allocator:delete_region. Added a few ASSERT_HOLDING_SPIN_LOCK to guard against future bitrot.

Author: PeterSolMS
Assignees: -
Labels:

area-GC-coreclr

Milestone: -

@Maoni0
Copy link
Member

Maoni0 commented Mar 23, 2021

is there any reason we would use enter_spin_lock for this? enter_spin_lock's main advantage is it's aware of a GC happening and can correctly wait till the GC is done if it needs to. do you anticipate this would need to wait for the GC? this is already running in the code path where we'd want to finish up ASAP so if a GC needs to start it wouldn't need to wait for us for long.

Copy link
Member

@Maoni0 Maoni0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be fine for our current state; we may want to put in some SwitchToThread later when we are running in more stressful situations.

@PeterSolMS PeterSolMS merged commit 79e87a9 into dotnet:main Mar 26, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Apr 25, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants