Fix style issues, a typo in "kern.ipc.nmbufs" and correctly plave and

expose the value of the tunable maxmbufmem as "kern.ipc.maxmbufmem"
through sysctl.

Reported by:	smh
MFC after:	1 day
This commit is contained in:
Andre Oppermann 2013-07-11 12:46:35 +00:00
parent 4f9c9114a3
commit e0c00adda2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253204

View File

@ -104,13 +104,18 @@ int nmbjumbo9; /* limits number of 9k jumbo clusters */
int nmbjumbo16; /* limits number of 16k jumbo clusters */
struct mbstat mbstat;
static quad_t maxmbufmem; /* overall real memory limit for all mbufs */
SYSCTL_QUAD(_kern_ipc, OID_AUTO, maxmbufmem, CTLFLAG_RDTUN, &maxmbufmem, 0,
"Maximum real memory allocateable to various mbuf types");
/*
* tunable_mbinit() has to be run before any mbuf allocations are done.
*/
static void
tunable_mbinit(void *dummy)
{
quad_t realmem, maxmbufmem;
quad_t realmem;
/*
* The default limit for all mbuf related memory is 1/2 of all
@ -120,7 +125,7 @@ tunable_mbinit(void *dummy)
realmem = qmin((quad_t)physmem * PAGE_SIZE,
vm_map_max(kmem_map) - vm_map_min(kmem_map));
maxmbufmem = realmem / 2;
TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem);
TUNABLE_QUAD_FETCH("kern.ipc.maxmbufmem", &maxmbufmem);
if (maxmbufmem > realmem / 4 * 3)
maxmbufmem = realmem / 4 * 3;
@ -204,7 +209,7 @@ sysctl_nmbjumbo9(SYSCTL_HANDLER_ARGS)
newnmbjumbo9 = nmbjumbo9;
error = sysctl_handle_int(oidp, &newnmbjumbo9, 0, req);
if (error == 0 && req->newptr) {
if (newnmbjumbo9 > nmbjumbo9&&
if (newnmbjumbo9 > nmbjumbo9 &&
nmbufs >= nmbclusters + nmbjumbop + nmbjumbo9 + nmbjumbo16) {
nmbjumbo9 = newnmbjumbo9;
uma_zone_set_max(zone_jumbo9, nmbjumbo9);
@ -258,7 +263,7 @@ sysctl_nmbufs(SYSCTL_HANDLER_ARGS)
}
return (error);
}
SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbuf, CTLTYPE_INT|CTLFLAG_RW,
SYSCTL_PROC(_kern_ipc, OID_AUTO, nmbufs, CTLTYPE_INT|CTLFLAG_RW,
&nmbufs, 0, sysctl_nmbufs, "IU",
"Maximum number of mbufs allowed");