Calculating per jail memory usage ...

Menshikov Konstantin kostjn at peterhost.ru
Thu Jun 4 05:35:07 UTC 2009


Marc G. Fournier wrote:
>
> Are there any tools for this that are either in ports, or others would 
> like to share?
>
> ----
> Marc G. Fournier           Hub.Org Networking Services 
> (http://www.hub.org)
> Email . scrappy at hub.org                              MSN . 
> scrappy at hub.org
> Yahoo . yscrappy               Skype: hub.org        ICQ . 7615664
> _______________________________________________
> freebsd-jail at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-jail
> To unsubscribe, send any mail to "freebsd-jail-unsubscribe at freebsd.org"
>
Hi.
You can consider memory occupied with processes in jail as sum RSS of 
these processes, but it is wrong.

Processes divide memory among themselves, a segment of the text or all 
memory (if not to do exec after fork).

Now in a kernel there is no mechanism with which help it is possible to 
count a memory size occupied with processes in jail.
After this mechanism will appear, it will be possible to add top :)

There is a patch for restriction of resources jail, 
http://wiki.freebsd.org/Jails, CPU + RAM Limits for Current.
In it, it is considered memory which is used by processes in jail.
Further using a system call jail_get it is possible to receive a memory 
size used jail.
The program jget thus works.
Example

[root at book /home/kostjn]# ./jget.o 1
Jail limits and rusage, jid = 1
Limits: CPU 5, MEM 64M, NPROC 128, NOFILE 512
Usage: CPU 0, MEM 6M, NPROC 9, NOFILE 65


--
Menshikov Konstantin


More information about the freebsd-jail mailing list