kernel mget limit

rick at snowhite.cis.uoguelph.ca rick at snowhite.cis.uoguelph.ca
Tue Mar 7 21:27:04 UTC 2006


I've been trying to figure out how I can check to see if resources for
kernel malloc() and mget() are nearing (but not at) their allocation
limit. Wading around in the vm sources, I haven't figured out much.
The following snippet of code is all I've come up with. (It looks like
uz_allocs might also be useful, but I have no idea what upper bound
would make sense, if any.)

	if ((zone_mbuf->uz_keg->uk_maxpages > 0 &&
	     (zone_mbuf->uz_keg->uk_pages + zone_mbuf->uz_keg->uk_pages/10) >=
	     zone_mbuf->uz_keg->uk_maxpages) ||
	    (zone_clust->uz_keg->uk_maxpages > 0 &&
	     (zone_clust->uz_keg->uk_pages+zone_clust->uz_keg->uk_pages/10) >=
	     zone_clust->uz_keg->uk_maxpages)) {
		- Allocation near limit for mbufs/clusters

This would be useful, so that my NFSv4 server knows when to return
NFS4ERR_RESOURCE.

Any help with this would be appreciated. Thanks, rick


More information about the freebsd-current mailing list