memory.max = max annoyance :)

sava1e

Member
Sep 7, 2023
13
9
8
I am proxmox 9.0.11 / 6.14.11-4-pve kernel.
When I create a LXC container the cgroups (v2) is actaully working inside the lxc guest. Except there is one annoyance:
cat /sys/fs/cgroup/memory.max always returns 'max', while other info does work. I.e. /sys/fs/cgroup/memory.current gives the current amount of RAM used in the LXC container.
Some .net software I run actually use this /sys/fs/cgroup/memory.max to know how many RAM can be used. In this case the software crashes after a while as I do set a memory limit, but this isn't respected by the .net software.

I found this as well:
 
Have you tried gathering the required value from /proc/meminfo?
There are MemTotal, MemFree and MemAvailable properties available.
 
Have you tried gathering the required value from /proc/meminfo?
There are MemTotal, MemFree and MemAvailable properties available.

For my own scripts / software that works, but for some software it's out of my control... It would be nice if the '/sys/fs/cgroup/memory.max' would give the configured LXC memory value imo.
 
There are different values and they all have different meanings depending on a variety of configurations. Your software should allow you to configure max memory, don't depend on auto-discovery as it does not take into account things like ballooning, containers, other applications etc.