Re: [vserver] memory limits: where & how to mount /dev/cgroups?

From: Jarry <mr.jarry_at_gmail.com>
Date: Tue 22 Nov 2011 - 18:34:54 GMT
Message-ID: <4ECBEB4E.2040701@gmail.com>

On 21-Nov-11 23:01, Jean Weisbuch wrote:
> Le 21/11/2011 21:51, Jarry a écrit :
>>
>> I'm trying to set-up memory limits for my vserver-guests.
>> Documentation says "Beginning with vs2.3.0.36.29 you should
>> use cgroups to set memory limits".
>
> Here is an example (in this example we will have 1gb of memory on the
> guest and no virtual swap (soft and hard limit are the same, raise
> VDSRAMHARDLIMIT to 2048 if you want 1gb of memory + 1gb of "swap")) :
> (print in mksh is a builtin "equivalent" to echo in bash)
>
> VDSRAMLIMIT="1024"
> VDSRAMHARDLIMIT="1024"
> VDSRAMLIMITBYTES="$(print -- "${VDSRAMLIMIT}*1048576" |bc)"
> VDSRAMHARDLIMITBYTES="$(print -- "${VDSRAMHARDLIMIT}*1048576" |bc)"
> print -- "$VDSRAMLIMITBYTES" >|
> /etc/vservers/${xid}/cgroup/memory.limit_in_bytes
> print -- "$VDSRAMHARDLIMITBYTES" >|
> /etc/vservers/${xid}/cgroup/memory.memsw.limit_in_bytes
> print -- "$VDSRAMLIMITBYTES" >| /dev/cgroup/${xid}/memory.limit_in_bytes
> print -- "$VDSRAMHARDLIMITBYTES" >|
> /dev/cgroup/${xid}/memory.memsw.limit_in_bytes

Thanks for help, but it still does not work for me.
1. /dev/cgroups is mounted and visible in host.
2. util-vserver version is 0.30.216_pre2910
3. I defined 512MB "soft" and 1GB "hard" limits:

host # more /etc/vservers/vs6/cgroup/memory.limit_in_bytes
536870912
host # more /etc/vservers/vs6/cgroup/memory.memsw.limit_in_bytes
1073741824
host # more /dev/cgroup/vs6/memory.limit_in_bytes
536870912
host # more /dev/cgroup/vs6/memory.memsw.limit_in_bytes
1073741824

Yet in "vs6" guest I still see the whole 16GB RAM & 50GB swap:

vs6 # free
        total used free shared buffers cached
Mem: 16447700 426588 16021112 0 32840 38804
-/+ buffers/cache: 354944 16092756
Swap: 52428732 0 52428732

So where is the problem? What am I doing wrong?

Jarry

-- 
_______________________________________________________________
This mailbox accepts e-mails only from selected mailing-lists!
Everything else is considered to be spam and therefore deleted.
Received on Tue Nov 22 18:36:41 2011
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Tue 22 Nov 2011 - 18:36:41 GMT by hypermail 2.1.8