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

GC sometimes reports survival rates above 100% #100594

Open
markples opened this issue Apr 3, 2024 · 2 comments
Open

GC sometimes reports survival rates above 100% #100594

markples opened this issue Apr 3, 2024 · 2 comments
Assignees
Milestone

Comments

@markples
Copy link
Member

markples commented Apr 3, 2024

Easiest repro is to only allocate large objects - gcperfsim -tc 36 -tagb 100 -tlgb 0 -lohar 1000 -pohar 0 -sohsr 100-4000 -lohsr 16002400-16004800 -pohsr 100-204800 -sohsi 0 -lohsi 0 -pohsi 0 -sohpi 0 -lohpi 0 -sohfi 0 -lohfi 0 -pohfi 0 -allocType reference -testKind time - but this requires a separate gcperfsim fix.

This is due to allocations occurring during BGC. They are counted as survived but not at the start (i.e., in the numerator but not the denominator). It looks like inaccuracies are possible for all generations, but it easiest to expose it as >100% with large objects.

@markples markples added this to the 9.0.0 milestone Apr 3, 2024
@markples markples self-assigned this Apr 3, 2024
Copy link
Contributor

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

markples added a commit that referenced this issue May 2, 2024
The survival rate calculation for BGCs includes objects allocated during the BGC in the numerator but not denominator. This fixes that by adding them to size_before. The existing counters are reset mid-BGC, so the mark and sweep phases need to be added at separate points. I verified the fix over several gcperfsim runs and watched the counters getting updated in the debugger.

This includes some new and moved comments from going through the phases of BGC and putting similarly ifdef-ed code together.

Partial fix for #100594
@markples
Copy link
Member Author

markples commented May 7, 2024

This issue is still relevant for ephemeral generations, but the impact there is closer to rounding error than the large swings that can be seen in LOH (due to the small -number- of allocations).

michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this issue May 9, 2024
The survival rate calculation for BGCs includes objects allocated during the BGC in the numerator but not denominator. This fixes that by adding them to size_before. The existing counters are reset mid-BGC, so the mark and sweep phases need to be added at separate points. I verified the fix over several gcperfsim runs and watched the counters getting updated in the debugger.

This includes some new and moved comments from going through the phases of BGC and putting similarly ifdef-ed code together.

Partial fix for dotnet#100594
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this issue May 30, 2024
The survival rate calculation for BGCs includes objects allocated during the BGC in the numerator but not denominator. This fixes that by adding them to size_before. The existing counters are reset mid-BGC, so the mark and sweep phases need to be added at separate points. I verified the fix over several gcperfsim runs and watched the counters getting updated in the debugger.

This includes some new and moved comments from going through the phases of BGC and putting similarly ifdef-ed code together.

Partial fix for dotnet#100594
@markples markples modified the milestones: 9.0.0, 10.0.0 Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant