runtime-spec icon indicating copy to clipboard operation
runtime-spec copied to clipboard

config-linux: add support for rsvd hugetlb cgroup

Open kailun-qin opened this issue 4 years ago • 1 comments

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 https://github.com/opencontainers/runtime-spec/issues/1050

Signed-off-by: Kailun Qin [email protected]

kailun-qin avatar Aug 06 '21 09:08 kailun-qin

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

snecklifter avatar Dec 15 '21 10:12 snecklifter

This (together with runtime implementation) should fix the real issue with some software, described in https://github.com/opencontainers/runtime-spec/issues/1050.

kolyshkin avatar Mar 16 '23 20:03 kolyshkin

@tianon PTAL

kolyshkin avatar Mar 17 '23 18:03 kolyshkin

Thanks @kailun-qin!

odinuge avatar Mar 22 '23 10:03 odinuge

@kailun-qin @odinuge Do you have a PR for runc? (https://github.com/opencontainers/runc/pull/2360 seems closed)

AkihiroSuda avatar Apr 04 '23 18:04 AkihiroSuda