-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix card marking issue #64748
Conversation
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.
Tagging subscribers to this area: @dotnet/gc Issue DetailsFix 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.
|
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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.