[libvirt-users] LXC Memory Limits wont work

Daniel P. Berrangé berrange at redhat.com
Mon Aug 6 08:35:05 UTC 2018


On Wed, Aug 01, 2018 at 12:53:58PM +0200, Markus Raps wrote:
> Hello,
> 
> iam currently trying to run LXC Containers with libvirt
> but the memory limit doesn't want to work
> 
> in the container i see the full 32GB from the Host OS
> iam pretty sure that iam missing a configline in the xml
> 
> lxc-template ~ # free -m
>               total        used        free      shared  buff/cache
> available
> Mem:          32108         626       31396         249          85
> 31396
> Swap:             0           0           0
> lxc-template ~ #


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)

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvirt-users mailing list