Skip to content

cgroup: set hugetlb reservation limits - #2390

Merged
kolyshkin merged 2 commits into
containers:mainfrom
kolyshkin:hugetlb-rsvd
Oct 21, 2026
Merged

kolyshkin merged 2 commits into
containers:mainfrom
kolyshkin:hugetlb-rsvd

Conversation

@kolyshkin

@kolyshkin kolyshkin commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Since Linux 5.7, the hugetlb controller has reservation accounting
(hugetlb.<size>.rsvd.max on cgroup v2, hugetlb.<size>.rsvd.limit_in_bytes
on cgroup v1). The runtime spec says hugepageLimits should use it when
supported, but crun only set the page fault accounting limit.

Write the limit to the rsvd file as well, unless it does not exist.

Also, add a test which checks hugetlb limits (including rsvd ones, if
available) for all available huge page sizes. Tested locally on CentOS
Stream 10 and Fedora; without the fix, the test fails as expected.

Fixes: #2284
Supersedes: #2387, #2290

Since Linux 5.7, the hugetlb controller has reservation accounting
(hugetlb.<size>.rsvd.max on cgroup v2, hugetlb.<size>.rsvd.limit_in_bytes
on cgroup v1), which also covers huge pages that are reserved but not
yet faulted in. The runtime spec says hugepageLimits should use it
when supported, falling back to page fault accounting otherwise.

Write the limit to the rsvd file as well, unless it does not exist.

This is similar to what runc does.

Fixes: containers#2284

Assisted-by: Claude Code (claude-opus-5-5)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Check that hugepageLimits are set for every available huge page size,
including the reservation limits, if supported by the kernel.

Assisted-by: Claude Code (claude-opus-5-5)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

@giuseppe giuseppe left a comment

Copy link
Copy Markdown
Member

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 3918405 into containers:main Oct 21, 2026
66 checks passed
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.

crun leaves supported HugeTLB reservation limits unlimited

2 participants