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

Enable cgroups hierarchical memory limits support #93611

Merged
merged 7 commits into from
Oct 19, 2023

Conversation

janvorli
Copy link
Member

Cgroups can limit memory hierarchically. That means that ancestor cgroups can apply limits that are lower than the current cgroup's memory limit. .NET runtime is not honoring these hierarchical limits with either cgroups v1 or cgroups v2.
This change fixes it. The implementation is different for cgroups V1 and V2 because cgroups v1 provide aggregated hierarchical limit value in the memory.stat, but in cgroups v2, runtime needs to walk the cgroup hierarchy and find the lowest limit in it.

Cgroups can limit memory hierarchically. That means that ancestor
cgroups can apply limits that are lower than the current cgroup's
memory limit. .NET runtime is not honoring these hierarchical limits
with neither cgroups v1 nor cgroups v2.
This change fixes it. The implementation is different for cgroups V1
and V2 because cgroups v1 provide aggregated hierarchical limit value
in the memory.stat, but in cgroups v2, runtime needs to walk the
cgroup hierarchy and find the lowest limit in it.
* Remove cgroup memory related stuff from the coreclr PAL
* Real fix to the managed cgroup issue with cgroup v1 filesystem type detection
@jkotas
Copy link
Member

jkotas commented Oct 18, 2023

Build breaks. Lgtm otherwise.

…n/tests/DescriptionNameTests.cs

Co-authored-by: Jan Kotas <[email protected]>
@janvorli janvorli merged commit e2a3a7f into dotnet:main Oct 19, 2023
151 checks passed
@janvorli janvorli deleted the enable-hierarchical-limits-support branch October 19, 2023 17:06
@lewing
Copy link
Member

lewing commented Oct 19, 2023

This broke the outerloop palsuite tests because of a removed symbol

https://dev.azure.com/dnceng-public/public/_build/results?buildId=444318&view=logs&jobId=efb0e688-765b-56f1-1b94-fb914f4a08b7&j=efb0e688-765b-56f1-1b94-fb914f4a08b7&t=0e66e276-1ec2-597c-a7ec-8bd834919a09

 /__w/1/s/src/coreclr/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp:37:24: error: use of undeclared identifier 'PAL_GetRestrictedPhysicalMemoryLimit'
      size_t mem_limit = PAL_GetRestrictedPhysicalMemoryLimit();
                         ^

@janvorli
Copy link
Member Author

Ah, I am sorry for that, Iet me fix it right away.

@janvorli
Copy link
Member Author

PR with the fix is here: #93757

@ghost ghost locked as resolved and limited conversation to collaborators Nov 19, 2023
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