Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Mar 2006 16:28:19 -0500 (EST)
From:      rick@snowhite.cis.uoguelph.ca
To:        freebsd-current@freebsd.org
Subject:   kernel mget limit
Message-ID:  <200603072128.QAA75476@snowhite.cis.uoguelph.ca>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603072128.QAA75476>