[libvirt-users] LXC Memory Limits wont work

Rene Pasing rene at pasing.net
Mon Aug 6 14:53:50 UTC 2018


On 06.08.2018 10:35, Daniel P. Berrangé wrote:
> The 'free' command reports what is present in the host, which is distinct
> from what's made available to the container. This isn't unique to libvirt
> LXC containers - in fact any command that is runnning in a cgroup with
> memory controller limits applied will see the same behaviour. Apps can't
> assume that 'free' reflects the amount of memory that is available to
> them. Instead they need to look at cgroups memory controller that they
> are placed under (/proc/self/cgroups tells you where)
I think this is not completely true... I had a similiar problem in the 
past, and I could get it fixed by using e.g. this in the domains XML:

   <memtune>
     <hard_limit unit='KiB'>4194304</hard_limit>
     <soft_limit unit='KiB'>4194304</soft_limit>
     <swap_hard_limit unit='KiB'>4194304</swap_hard_limit>
   </memtune>

`free` then reports the correct values. Maybe you can give that a try 
@Markus Raps? Of course make sure to check out the documentation[1] of 
these config elements to make sure you really want what they do.

Regards
Rene

[1] = https://libvirt.org/formatdomain.html#elementsMemoryTuning




More information about the libvirt-users mailing list