Subject: Re: [vserver] vserver guest memory usage: cache/buffers?
From: Corey Wright <undefined@pobox.com>
Date: Wed, 30 Nov 2011 01:43:24 -0600
Wed, 30 Nov 2011 01:43:24 -0600
On Tue, 29 Nov 2011 22:40:58 +0100Jarry <mr.jarry@gmail.com> wrote:

> On 29-Nov-11 21:40, Herbert Poetzl wrote:
> 
> >> And what is even worse, it seems there are actually
> >> no limits at all. vserver-stat show that vs-guest
> >> takes more memory than I allowed. But the "old way"
> >> (rss.soft, rss.hard) at least works. Strange...
> >
> > I'm pretty sure it doesn't work with kernels newer than
> > 2.6.34 though, because the code doing that simply isn't
> > there anymore :)
> 
> I see I mixed it a "little bit". I'm running 2 kernels:
> 
> 1). 2.6.35 with vs2.3.0.36.32, where memory limits
>      using cgroups do not work. I have no idea why...

works for me with 2.6.35.14-vs2.3.0.36.33.

see attached screen log showing configuration and demonstrating memory limits.

i can also verify that the same configuration works for 3.1.4-vs2.3.2.1 and
3.0.12-vs2.3.2.1 (minus the memory.memsw.limit_in_bytes because i didn't
notice i had to set CONFIG_CGROUP_MEM_RES_CTLR_SWAP_ENABLED though
CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y as in 2.6.35).

corey
--
undefined@pobox.com

> 2). 2.6.22 with vs2.2.0.7, where memory limits
>      using rss.hard and rss.soft do work. Only with
>      this kernel I see correct limited memory in vs-guest.
> 
> There is one more vserver-patch in my repository (2.3.1
> maybe for kernel 3.x?), but it is masked as "unstable".
> I'm not sure it is suitable for server, but I'll try it.
> 
> Jarry
> -- 
> _______________________________________________________________
> This mailbox accepts e-mails only from selected mailing-lists!
> Everything else is considered to be spam and therefore deleted.
> 


root@vserver-squeeze-amd64:~# vserver-info dontcare SYSINFO | head -n5
Versions:
                   Kernel: 2.6.35.14-vs2.3.0.36.33+1-k8-x6
                   VS-API: 0x00020306
                      VCI: 0x0000000013001f11
             util-vserver: 0.30.216-pre3000; Nov 16 2011, 00:24:48
root@vserver-squeeze-amd64:~# grep CGROUP /boot/config-2.6.35.14-vs2.3.0.36.33+1
-k8-x6
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_NS=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_MEM_RES_CTLR=y
CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y
CONFIG_CGROUP_SCHED=y
CONFIG_BLK_CGROUP=y
# CONFIG_DEBUG_BLK_CGROUP is not set
CONFIG_NET_CLS_CGROUP=y
root@vserver-squeeze-amd64:~# cat /etc/vservers/test1/cgroup/memory.limit_in_byt
es
128M
root@vserver-squeeze-amd64:~# cat /etc/vservers/test1/cgroup/memory.memsw.limit_
in_bytes
192M
root@vserver-squeeze-amd64:~# cat /etc/vservers/test1/cflags
virt_mem
root@vserver-squeeze-amd64:~# free
             total       used       free     shared    buffers     cached
Mem:        379736      54168     325568          0       3408      24500
-/+ buffers/cache:      26260     353476
Swap:       138236         84     138152
root@vserver-squeeze-amd64:~# vserver test1 start
Using makefile-style concurrent boot in runlevel 2.
Starting enhanced syslogd: rsyslogd.
root@vserver-squeeze-amd64:~# vserver test1 enter
root@test1:/# free
             total       used       free     shared    buffers     cached
Mem:        131072       1356     129716          0          0        216
-/+ buffers/cache:       1140     129932
Swap:        65536          0      65536
root@test1:/# stress --vm 1 --vm-bytes 192M
stress: info: [3336] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
[ 3494.233622] Memory cgroup out of memory: kill process stress(3337:#101) score
 50740 or a child
[ 3494.234299] Killed process stress(3337:#101) vsz:202960kB, anon-rss:110796Kb,
 file-rss:180kB
stress: FAIL: [3336] (416) <-- worker 3337 got signal 9
stress: WARN: [3336] (418) now reaping child worker processes
stress: FAIL: [3336] (452) failed run completed in 2s