No limitation in physical memory in cgroups

anqin anqin.qin at gmail.com
Tue May 19 22:52:29 PDT 2009


Hi all,

I would like to bind given physical memory to specific task group,
however it does not take effect in my experiments. Are there
something wrong in my experiments.

My experiment is done under the kernel 2.6.29.3 and I constructed
my task group by following commands:

a) In shell #1, prepare a bash :

# bash
# echo $$
2253

b) In shell #2, prepare the memory control via cgroupfs:

# mount -t cgroup cgroup /mnt/mycgrp
# cd /mn/mycgrp
# mkdir mycontainer
# echo 0 > mycontainer/cpuset.mems
# echo 0-1 > mycontainer/cpuset.cpus
# echo 2252 > mycontainer/tasks

# cat mycontainer/memory.usage_in_bytes
2875392
# echo 3000000 > mycontainer/memory.max_usage_in_bytes
# cat mycontainer/memory.max_usage_in_bytes
3002368


c) In Shell #1, run a memory consumer (in which, malloc() is called
to allocate memory and not free until program is existed) to allocate
500M memory:

# /tmp/memoy_consumer_program  500

In Shell #2, the used memory ascends from start point 2875392 when
program begins (from number presented in memory.usage_in_bytes),
but it return to start point when it touches the maximal boundary.

On the other hand, I also run the top to watch the memory hold by
memoy_consumer_program. In top, the memory (both virtual and rss
memory ) is always growing without any limitation.

Is this phenomenon the correct behaviors of memory cgroups?


Best Regards,

Anqin


More information about the Containers mailing list