Checking memory limit inside a container
KAMEZAWA Hiroyuki
kamezawa.hiroyu at jp.fujitsu.com
Thu Apr 19 01:24:19 UTC 2012
(2012/04/19 8:13), Matt Chapman wrote:
> Hello,
>
> I'm new to using LXC, but really impressed so far. I'm trying to set-up
> memory limits for a container, and have added these lines to my container
> config file:
>
> lxc.cgroup.memory.limit_in_bytes = 15872M
> lxc.cgroup.memory.memsw.limit_in_bytes = 16896M
>
> ...and I've stopped & restarted my container.
>
> But from inside the container, using `free` or `top`,etc, still reports the
> total available memory as that of the host system, not what has been
> allocated to the container.
>
Yes, now, usual commands see /proc/meminfo, it's not virtualized yet.
We have plans but...it's not implemented yet.
> Is this normal, or does it suggest I did something wrong? Is there a way to
> accurately check memory usage for a container from within that container?
> Or even from the host system?
>
IIUC, the only way we have is
# cat /path-to-cgroup/memory.usage_in_bytes
# cat /path-to-cgroup/memory.stat
Or you can use some libcgroup commands as cgget...
I'm sorry if I don't know existing useful lxc memory checker.
Thanks,
-Kame
More information about the Containers
mailing list