2009/8/23 Krzysztof Taraszka <span dir="ltr"><<a href="mailto:krzysztof.taraszka@gnuhosting.net">krzysztof.taraszka@gnuhosting.net</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2009/8/23 Krzysztof Taraszka <span dir="ltr"><<a href="mailto:krzysztof.taraszka@gnuhosting.net" target="_blank">krzysztof.taraszka@gnuhosting.net</a>></span><br><div class="gmail_quote"><div><div></div><div class="h5">
<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><br><br><div class="gmail_quote">2009/8/23 Daniel Lezcano <span dir="ltr"><<a href="mailto:daniel.lezcano@free.fr" target="_blank">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>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;">
2009/8/23 Daniel Lezcano <<a href="mailto:daniel.lezcano@free.fr" target="_blank">daniel.lezcano@free.fr</a>><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Krzysztof Taraszka wrote:<br>
<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>
<br>
</blockquote>
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<br>
see all the memory available on the system either if you are not allowed to<br>
use more than 32MB. If you create a program which allocates 64MB within a<br>
container configured with 32MB, and you "touch" the pages (may be that can<br>
be done with one mmap call with the MAP_POPULATE option), you should see the<br>
application swapping and the "memory.failcnt" increasing.<br>
<br>
IMHO, showing all the memory available for the system instead of showing<br>
the allowed memory with the cgroup is weird but maybe there is a good reason<br>
to do that.<br>
<br>
<br>
</blockquote>
<br>
Thank you Daniel for your reply.<br>
I think that LXC should isolate memory available for containers like Vserver<br>
or FreeVPS do (memory + swap) if .cgroup.memory.* and<br>
lxc.cgroup.memory.memsw.* is set.<br>
Is there any possibility to make a patch for linux kernel / lxc-tools to<br>
show the limitations inside cointainers propertly? I think is a good idea<br>
and it should be apply as soon as possible.<br>
</blockquote>
<br></div></div>
Maybe a solution can be to add a new memory.meminfo file in the same format than /proc/meminfo, so it will be possible to mount --bind /cgroup/foo/memory.meminfo to /proc/meminfo for the container.<br>
</blockquote></div><br></div></div>Yes, I thought the same. This should allow the user-space tools based on /proc/meminfo (such as comand line "free") show limited information :)<br></blockquote></div></div><div>
<br>Hmmm... does the memory.stat is a good start point for make new one object memory.meminfo similar to /proc/meminfo? If so, I can play by my self with lxc-tools code.<br>
</div></div></blockquote><div><br><br>Hmmm... Daniel, I have got a question (that do I thinking in the right way).<br>here is an output from /proc/meminfo from openvz:<br><br><br>MemTotal:             262144 kB<br>MemFree:            232560 kB<br>
Buffers:             0 kB<br>Cached:            0 kB<br>SwapCached:        0 kB<br>Active:            0 kB<br>Inactive:            0 kB<br>HighTotal:            0 kB<br>HighFree:            0 kB<br>LowTotal:             262144 kB<br>
LowFree:            232560 kB<br>SwapTotal:        0 kB<br>SwapFree:        0 kB<br>Dirty:             0 kB<br>Writeback:        0 kB<br>AnonPages:        0 kB<br>Mapped:            0 kB<br>Slab:                0 kB<br>SReclaimable:            0 kB<br>
SUnreclaim:              0 kB<br>PageTables:              0 kB<br>NFS_Unstable:           0 kB<br>Bounce:                  0 kB<br>WritebackTmp:            0 kB<br>CommitLimit:             0 kB<br>Committed_AS:            0 kB<br>
VmallocTotal:            0 kB<br>VmallocUsed:             0 kB<br>VmallocChunk:            0 kB<br>HugePages_Total:    0<br>HugePages_Free:    0<br>HugePages_Rsvd:   0<br>HugePages_Surp:    0<br>Hugepagesize:         2048 kB<br>
<br>most of values are 0.<br><br>I have an question about SwapTotal and SwapFree for LXC.<br>As I thinking that:<br><br>MemTotal might be: hierarchical_memory_limit<br>MemFree might be: hierarchical_memory_limit - cache<br>
<br>the <br><br>SwapTotal might be: hierarchical_memsw_limit<br>SwapFree might be: hierarchical_memsw_limit - rss<br><br>rss - # of bytes of anonymous and swap cache memory<br>I don't know at all that hierarchical_memsw_limit is an good value for swap total, because as I read it is a mem+swap at all.<br>
<br>Does the lxc memory.meminfo might look like above? Where can I get the Hugepagesize?<br><br>-- <br>Krzysztof Taraszka<br></div></div>