resource limits Giant patch

Mike Makonnen mtm at identd.net
Thu Apr 3 03:19:42 PST 2003


The following patches at http://people.freebsd.org/~mtm
remove process resource limits out from under Giant. I have been bouncing
them off jhb for a while now, and I think they are ready. I would appreciate
a review/testing....

There are 4 incremental patches for your reviewing pleasure :-)
infrastructure.diff	- The necessary infrastructure to do the locking
users.diff		   - Modify consumers of resource limits to use the locks
giant.diff		    - actually remove Giant from (most of) those areas
regen.diff		   - Regenerated files, if you don't care to regenerate your own

The basic implementation:
Each plimit now has an associated mutex.
To read an individual limit it is sufficient that the proc lock is held.
To modify a limit or in situations where you need a consitent view of
a particular limit(s) both the proc lock and the plimit locks are held.
Three new functions can be use to get limits: lim_cur(), lim_max(), and
lim_rlimit(), that can be used to obtain the current limit, the hard limit, and
the entire rlimit structure, respectively.
A limit_lock has been defined to protect the following three globals:
	maxfiles, maxfilesperproc, and maxprocperuid 
They each now have their own sysctl proc that grabs the limit_lock
in order to write them.


Cheers.
-- 
Mike Makonnen  | GPG-KEY: http://www.identd.net/~mtm/mtm.asc
mtm at identd.net | D228 1A6F C64E 120A A1C9  A3AA DAE1 E2AF DBCC 68B9


More information about the freebsd-current mailing list