[release/8.0-staging] Guard against -1 Returned from sysconf for the Cache Sizes Causing Large Gen0 Sizes and Budgets for Certain Linux Distributions.#100575
Merged
ericstj merged 14 commits intorelease/8.0-stagingfrom Apr 15, 2024
Conversation
Contributor
|
Tagging subscribers to this area: @dotnet/gc |
4 tasks
mangod9
approved these changes
Apr 3, 2024
This was referenced Apr 3, 2024
Member
FWIW, @Maoni0 noticed that the error handling is not right during codereview two years ago: #71029 (comment) . Unfortunately, this feedback was not followed up upon. |
jeffschwMSFT
approved these changes
Apr 3, 2024
Member
jeffschwMSFT
left a comment
There was a problem hiding this comment.
approved. we will take for consideration in 8.0.x
Member
|
The build failures are known issues: #100035 => This PR can be merged as the errors aren't related. |
Member
|
/ba-g all failures were classified as Known but the check did not flip to green. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #100502 to release/8.0-staging
/cc @mrsharm
Customer Impact
All runtimes running server GC running on Linux distributions that return -1 for the LEVEL4_CACHE_SIZE from sysconf are affected by the underlying issue that this PR addresses. The implications of this issue are that the gen0 budget is computed as a function of the total memory available and not the L3 cache size as before for certain Linux distributions such as Debian 12, and Ubuntu 22.04. Relying on the physical memory which is much larger than the L3 cache size results in extremely large gen0 budgets and thereby causing larger heap sizes and consequently, more memory utilization.
The internal customer impact reduced their overall memory utilization from 1 GB to 300 MB and were satisfied with the result.
Regression
This regression is as a result of changes to the result of sysconf for certain Linux distributions. The result that we are now guarding against is -1. The code that introduced this behavior by not vetting the output of sysconf (a long) and casting it to a size_t was: #71029; this was in the .NET 7 timeframe but probably didn't emanate to our user base since the values of sysconf for the L4 Cache Size for newer distributions started showing up as -1 if they didn't exist and where in previous cases such as for Debian 11, they had been 0. This was confirmed from running
getconf -a | grep CACHEon multiple distributions of Linux and the ones that exhibited this behavior e.g., Debian 12 indicated that there had been a change in the behavior by outputting -1.Testing
Risk
The risk of the fix is high as the code path is called for all SVR instances for Linux. However, this is a fix for an already existing issue and has been tested and verified.
Full Details can be found: #100502