<div class="gmail_quote">2009/8/23 Daniel Lezcano <span dir="ltr"><<a href="mailto:daniel.lezcano@free.fr">daniel.lezcano@free.fr</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">Krzysztof Taraszka wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
I am running lxc on my debian unstable sandbox and I have a few question<br>
about memory managament inside linux containers based on lxc project.<br>
<br>
I have got linux kernel 2.6.30.5 with enabled :<br>
<br>
+Resource counter<br>
++ Memory Resource Controller for Control Groups<br>
 +++ Memory Resource Controller Swap Extension(EXPERIMENTAL)<br>
<br>
lxc-checkconfig pass all checks.<br>
<br>
I read about cgroups memory managament (Documentation/cgroups/memory.txt)<br>
and I tried to pass those value to my debian sandbox.<br>
<br>
And...<br>
'free -m' and 'top/htop' still show all available memory inside container<br>
(also If I set 32M for lxc.cgroup.memory.limit_in_bytes and<br>
lxc.cgroup.memory.usage_in_bytes; and 64M for<br>
lxc.cgroup.memory.memsw.usage_in_bytes and<br>
lxc.cgroup.memory.memsw.limit_in_bytes free and top show all resources).<br>
<br>
What I did wrong? Does the container always show all available memory<br>
resources  without cgroup limitations?<br>
</blockquote>
<br></div></div>
At the first glance I would say the configuration is correct.<br>
But AFAIR, the memory cgroup is not isolated, if you specify 32MB you will see all the memory available on the system either if you are not allowed to use more than 32MB. If you create a program which allocates 64MB within a container configured with 32MB, and you "touch" the pages (may be that can be done with one mmap call with the MAP_POPULATE option), you should see the application swapping and the "memory.failcnt" increasing.<br>

<br>
IMHO, showing all the memory available for the system instead of showing the allowed memory with the cgroup is weird but maybe there is a good reason to do that.<br><br>
</blockquote></div><br><br>Thank you Daniel for your reply.<br>I think that LXC should isolate
memory available for containers like Vserver or FreeVPS do (memory +
swap) if .cgroup.memory.* and lxc.cgroup.memory.memsw.* is set.<br>
Is there any possibility to make a patch for linux kernel / lxc-tools
to show the limitations inside cointainers propertly? I think is a good
idea and it should be apply as soon as possible.<br><br>-- <br><font color="#888888">Krzysztof Taraszka</font><br>