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

Fix card marking issue #64748

Merged
merged 3 commits into from
Feb 8, 2022
Merged

Conversation

PeterSolMS
Copy link
Contributor

Fix issue where we didn't clear cards at the ends of regions.

The problem is that when we reach the end of a region during card marking, we clear the cards between card and card_of (end). If card_of (end) is equal to card, we end up clearing nothing at all.

A similar problem occurs when cards happen to be set between end and the end of the reserved memory of the region - these cards would never be cleared.

Both issues don't affect correctness, but they do affect performance for regions with very few cross generation pointers.

The fix is very simple - end_card already contains the first clear card after the current run of cards, so [card, end_card[ is exactly the correct range to pass to clear_cards.

The problem is that when we reach the end of a region during card marking, we clear the cards between card and card_of (end). If card_of (end) is equal to card, we end up clearing nothing at all.

A similar problem occurs when cards happen to be set between end and the end of the reserved memory of the region - these cards would never be cleared.

Both issues don't affect correctness, but they do affect performance for regions with very few cross generation pointers.
@ghost
Copy link

ghost commented Feb 3, 2022

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

Issue Details

Fix issue where we didn't clear cards at the ends of regions.

The problem is that when we reach the end of a region during card marking, we clear the cards between card and card_of (end). If card_of (end) is equal to card, we end up clearing nothing at all.

A similar problem occurs when cards happen to be set between end and the end of the reserved memory of the region - these cards would never be cleared.

Both issues don't affect correctness, but they do affect performance for regions with very few cross generation pointers.

The fix is very simple - end_card already contains the first clear card after the current run of cards, so [card, end_card[ is exactly the correct range to pass to clear_cards.

Author: PeterSolMS
Assignees: -
Labels:

area-GC-coreclr

Milestone: -

@PeterSolMS
Copy link
Contributor Author

I found that I didn't get the segment case correct - there we may clear too many cards at the end of gen 2 if gen 1 follows in the same segment. Fix is to go back to the equivalent of the old code.

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.

LGTM!

@PeterSolMS PeterSolMS merged commit e696177 into dotnet:main Feb 8, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 10, 2022
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.

2 participants