About this list Date view Thread view Subject view Author view Attachment view

From: Thorsten Gunkel (tgunkel-lists_at_tgunkel.de)
Date: Mon 20 Dec 2004 - 01:00:42 GMT


(Please ignore that until Herbert/Bertl acknowledges that I didn't
 misunderstood him completely ;-))

Hi *,
just in case this is interesting for someone:

********* Mini Howto for CPU hard limits ************

I did it with:

- 2.6.9 vanilla Kernel
- patch-2.6.9-vs1.9.3.diff

In kernel config enable

CONFIG_VSERVER_HARDCPU=y

and optionally

CONFIG_VSERVER_HARDCPU_IDLE=y

You may check if your kernel already supports this with:

gzip -dc /proc/config.gz | grep CONFIG_VSERVER_HARDCPU
(this will only work if your kernel creates a /proc/config.gz file,
 otherwise try
 grep /usr/src/linux/.config -e CONFIG_VSERVER_HARDCPU
 otherwise)

Now change to the etc folder for the vserver you want to hardlimit the
cpu power.

Create a file named flags and write

sched_hard

into it (don't forget final linebreak). If this file already exists
just append the new line.

No create a file named schedule. It must have 6 lines:

FillRate
Interval
StartNrOfTokens
tokens_min
tokens_max
IGNOREFORNOW

In short your vserver can only consume cpu power if it has tokens
left (to be more precisely: if it has more than tokens_min tokens).
The more cpu power it uses the more token it looses :-).
At the start it has StartNrOfTokens (or TokensMax if that is
smaller?). After each Interval has passed it gets FillRate new ones
until it reaches tokens_max.

So in short:
              higher FillRate and lower Interval -> more cpu power.

Example for your schedule file:

20
100
600
0
500
0

Every 100 ticks 20 new tokens, no tokens_min (one token is enough to be
back in business) max 500 tokens and a startvalue of
600 tokens (well, ...).

No start your vserver (don't enter it yet) and check

cat /proc/virtual/YOURID/status

| ...
| Flags: 0000000202000110
                       ^

It should end with 1..
If it doesn't your flags file is broken, try:

vattribute --set --xid YOURID --flag ^8
or
vattribute --set --xid YOURID --flag sched_hard

Now check

cat /proc/virtual/YOURID/sched

Token: 500
FillRate: 20
Interval: 100
TokensMin: 0
TokensMax: 500
PrioBias: 0
cpu 0: 59 48 0

If you now consume CPU power inside the vserver the Token value will
drop, if it reaches zero your vserver will stop and after 20 ticks
you'll get new tokens.

Have fun
 Thorsten


_______________________________________________
Vserver mailing list
Vserver_at_list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver


About this list Date view Thread view Subject view Author view Attachment view
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Mon 20 Dec 2004 - 01:08:18 GMT by hypermail 2.1.3