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

config-linux: add support for rsvd hugetlb cgroup #1116

Merged
merged 1 commit into from Mar 21, 2023

Conversation

kailun-qin
Copy link
Contributor

The previous non-rsvd max/limit_in_bytes does not account for reserved
huge page memory, making it possible for a process to reserve all the
huge page memory, without being able to allocate it (due to hugetlb
cgroup page fault accounting restrictions).

In practice this makes it possible to successfully mmap more huge page
memory than allowed via the cgroup settings, but when using the memory
the process will get a SIGBUS and crash. This is bad for applications
trying to mmap at startup (and it succeeds), but the program crashes
when starting to use the memory. eg. postgres is doing this by default.

This patch updates and clarifies LinuxResources.HugepageLimits and
LinuxHugepageLimit by defaulting the configurations go to rsvd hugetlb
cgroup (when supported) and fallback to page fault accounting if not
supported.

Fixes #1050

Signed-off-by: Kailun Qin kailun.qin@intel.com

The previous non-rsvd max/limit_in_bytes does not account for reserved
huge page memory, making it possible for a process to reserve all the
huge page memory, without being able to allocate it (due to hugetlb
cgroup page fault accounting restrictions).

In practice this makes it possible to successfully mmap more huge page
memory than allowed via the cgroup settings, but when using the memory
the process will get a SIGBUS and crash. This is bad for applications
trying to mmap at startup (and it succeeds), but the program crashes
when starting to use the memory. eg. postgres is doing this by default.

This patch updates and clarifies `LinuxResources.HugepageLimits` and
`LinuxHugepageLimit` by defaulting the configurations go to rsvd hugetlb
cgroup (when supported) and fallback to page fault accounting if not
supported.

Fixes opencontainers#1050

Signed-off-by: Kailun Qin <kailun.qin@intel.com>
@snecklifter
Copy link

@kailun-qin I'm confused, this patch only seems to include code comments and doc changes?

Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

@kolyshkin
Copy link
Contributor

This (together with runtime implementation) should fix the real issue with some software, described in #1050.

@kolyshkin
Copy link
Contributor

@tianon PTAL

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@kolyshkin kolyshkin merged commit 8a09257 into opencontainers:main Mar 21, 2023
@AkihiroSuda AkihiroSuda added this to the v1.1.0 milestone Mar 21, 2023
@odinuge
Copy link
Contributor

odinuge commented Mar 22, 2023

Thanks @kailun-qin!

@AkihiroSuda AkihiroSuda mentioned this pull request Mar 28, 2023
@AkihiroSuda
Copy link
Member

@kailun-qin @odinuge Do you have a PR for runc?
(opencontainers/runc#2360 seems closed)

@AkihiroSuda AkihiroSuda mentioned this pull request Jun 26, 2023
12 tasks
omprakaash added a commit to omprakaash/oci-spec-rs that referenced this pull request Mar 9, 2024
Adds support for the rsvd hugetlb cgroup. Enables reservation time checks on huge paqe memory limits. More info: opencontainers/runtime-spec#1116
omprakaash added a commit to omprakaash/oci-spec-rs that referenced this pull request Mar 9, 2024
Adds support for the rsvd hugetlb cgroup. Enables reservation time checks on huge paqe memory limits. More info: opencontainers/runtime-spec#1116

Signed-off-by: Om Prakaash <omsuseela@gmail.com>
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.

Add initial support for rsvd accounting hugetlb cgroup
7 participants