]> git.proxmox.com Git - pve-container.git/commit
memory: set cgroupv2 memory.high to ~99.6% of memory.max hard-limit
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 3 Oct 2022 09:10:30 +0000 (11:10 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 26 Apr 2023 14:58:10 +0000 (16:58 +0200)
commit09ea3e7fb3f166d11d245abf26ba9d02a829ab93
tree3b0b450c273c0d164396af79b90b699f99ea7b1a
parenta72424ba7296d846b8893d3c070138eb280c51cd
memory: set cgroupv2 memory.high to ~99.6% of memory.max hard-limit

cgroup memory usage is limited by the hard 'max' limit (OOM-killer
enforced) and the soft 'high' limit (cgroup processes get throttled
and put under heavy reclaim pressure). Set the latter high limit to
1016/1024 (~99.2%) of the 'max' hard limit, this scales with CT
memory allocations, & gives a decent 2^x based rest for 2^y memory
config which is still quite near the upper bound – clamp the maximum
gap between high and max at 128 MiB to avoid that huge container pay
quite an high amount of absolute cost.

A few example for differences between max & high for a few mem sizes:
- 2 MiB lower for 256 MiB max
- 16 MiB lower for 2 GiB max
- 128 MiB for 16 GiB and above

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/LXC.pm