swap test for cgroups
Kevin Wilson
wkevils at gmail.com
Sun Jan 31 03:18:57 EST 2016
Hi,
I had tried to perform the following test according to:
http://lxr.free-electrons.com/source/Documentation/cgroups/memcg_test.txt#L211
mkdir /sys/fs/cgroup/memory/group1
echo $$ > /sys/fs/cgroup/memory/group1/cgroup.procs
echo 40M > /sys/fs/cgroup/memory/group1/memory.limit_in_bytes
Run a process which is a very short program, allocating 100MB:
int main() {
// Allocate 100 MB
void *mem = malloc(1024*1024*100);
if (mem)
printf("malloc is ok\n");
pause();
}
VmSize seems a bit larger than 100MB, and this seems ok, when adding
the overhead of running a process:
cat /proc/$$/status | grep VmSize
VmSize: 116920 kB
cat /sys/fs/cgroup/memory/group1/memory.stat | grep swap
swap 0
total_swap 0
cat /proc/$$/status | grep -i swap
VmSwap: 0 kB
I would expect that the swap will be 60M according to the link to the
memcg_test.txt mentioned earlier.
Any ideas ?
Regards,
Kevin
More information about the Kernelnewbies
mailing list