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

Support setting max memory limit in cgroup v2 #129

Merged
merged 1 commit into from
Oct 23, 2023

Conversation

mzweilz
Copy link

@mzweilz mzweilz commented Oct 23, 2023

When setting memory.max/memory.swap.max in cgroup v2, Linux uses "max" instead of "-1" to indicate no restriction on memory usage. The set_limit and set_memswap_limit functions of the memory controller accept i64 as a parameter. In cgroupv2, if the parameter is -1, "max" should be written into the cgroup file.

@Tim-Zhang Tim-Zhang requested a review from liubin October 23, 2023 10:36
When setting memory.max/memory.swap.max in cgroup v2, Linux uses "max"
instead of "-1" to indicate no restriction on memory usage. The
set_limit and set_memswap_limit functions of the memory controller
accept i64 as a parameter. In cgroupv2, if the parameter is -1, "max"
should be written into the cgroup file.

Fixes kata-containers#128

Signed-off-by: mengze <mengze@linux.alibaba.com>
Copy link
Member

@Tim-Zhang Tim-Zhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @mzweilz

@Tim-Zhang Tim-Zhang merged commit 3c4b724 into kata-containers:main Oct 23, 2023
Tim-Zhang added a commit to Tim-Zhang/cgroups-rs that referenced this pull request Oct 25, 2023
To include kata-containers#126, kata-containers#127, kata-containers#129

Signed-off-by: Tim Zhang <tim@hyper.sh>
@Tim-Zhang Tim-Zhang mentioned this pull request Oct 25, 2023
Tim-Zhang added a commit to Tim-Zhang/cgroups-rs that referenced this pull request Oct 25, 2023
To include kata-containers#126, kata-containers#127, kata-containers#129

Signed-off-by: Tim Zhang <tim@hyper.sh>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants