From: J. Nick Koston (nick_at_cpanel.net)
Date: Mon 23 Sep 2002 - 06:58:54 BST
I've attached a patch against 2.4.19ctx-13 that creates a new
rlimit called RLIMIT_CTX_AS. You'll need to use attached
vserver-setmemlimit program to set the limit (right now it is hard
coded to a 200 meg limit ... just edit and recompile)
Basic howto:
Patch your kernel sources with the patch-2.4.19ctx-13
Patch your kernel sources with patch-rlimit-ctx-as.patch
Patch the vserver-0.20 package with vserver-0.20-ctx_as-limit.patch
Copy the new chcontext into /usr/sbin
Find the S_FLAGS line and add "mem" into the line
Example: S_FLAGS="lock nproc sched mem"
Compile the two vserver-*memlimit programs (note: vserver-setmemlimit
starts an ash shell by default.. edit the source and change it to bash
if you don't have ash)
gcc vserver-setmemlimit.c -o vserver-setmemlimit
gcc vserver-showmemlimit.c -o vserver-showmemlimit
[root_at_localhost root]# ./vserver-setmemlimit
# ./vserver-showmemlimit
Current Vserver Memory Limit: 200 Megs
# vserver <vservername> start
I'm not sure if this is the best way to do this, but it seems to
work ok. I have no idea if this is SMP safe, or if this is even a
good thing (tm) so I'd appricate comments.
-Nick