[SoC] Jail Resource Limits

Chris Jones cdjones-freebsd-hackers at novusordo.net
Mon Aug 21 11:09:49 UTC 2006

Hi, folks: I've completed the Summer of Code work on the jail  
resource limits (http://wikitest.freebsd.org/JailResourceLimits);  
jails can now have soft-ish limits placed on their memory and CPU usage.

Briefly, when a jail uses more memory than its limit, pages are  
clawed back by a new kernel process, jpager.  The clawback is at a  
configurable rate, though the proportion is currently fixed.  When a  
jail uses more CPU time in proportion to total CPU time used than the  
number of its CPU usage shares to the total CPU usage shares, its  
processes are dropped in priority until it's had its fair share of  
the total CPU time; if there are no other processes that want to run,  
they'll use up as much CPU time as they otherwise would.

We have a new command, jtune(8), which allows you to change the  
memory limit and CPU shares for a jail while it's running.  You can  
also set these when a jail's created.  Note that some sysctls need to  
be set (see jail(8) for details) before the limits will be enforced.

A tarball with everything you need to build the experimental kernel  
can be at http://www.ualberta.ca/~cdjones/cdjones_jail_soc2006.tgz  
--- please read the INSTALL document in docs/ carefully, as it's  
pretty easy to trash your libc.so.  The tarball is against RELENG_6  
as of a few hours ago; I expect to port it to CURRENT sometime this  
week, once I build CURRENT on the desktop whose libc.so I trashed  
while writing docs/INSTALL. :)

I look forward to your feedback.



More information about the freebsd-hackers mailing list