Make sure nmbclusters are initialized before maxsockets

by running the tunable_mbinit() SYSINIT at SI_ORDER_MIDDLE
before the init_maxsockets() SYSINT at SI_ORDER_ANY.

Reviewed by:		rwatson, zec
Sponsored by:		The FreeBSD Foundation
MFC after:		4 weeks
This commit is contained in:
bz 2008-12-10 22:17:09 +00:00
parent 72852bcf84
commit f30a0a94fe
2 changed files with 8 additions and 2 deletions

View File

@ -101,6 +101,11 @@ int nmbjumbo9; /* limits number of 9k jumbo clusters */
int nmbjumbo16; /* limits number of 16k jumbo clusters */
struct mbstat mbstat;
/*
* tunable_mbinit() has to be run before init_maxsockets() thus
* the SYSINIT order below is SI_ORDER_MIDDLE while init_maxsockets()
* runs at SI_ORDER_ANY.
*/
static void
tunable_mbinit(void *dummy)
{
@ -113,7 +118,7 @@ tunable_mbinit(void *dummy)
nmbjumbo9 = nmbjumbop / 2;
nmbjumbo16 = nmbjumbo9 / 2;
}
SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_ANY, tunable_mbinit, NULL);
SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_mbinit, NULL);
/* XXX: These should be tuneables. Can't change UMA limits on the fly. */
static int

View File

@ -236,7 +236,8 @@ SYSCTL_PROC(_kern_ipc, OID_AUTO, maxsockets, CTLTYPE_INT|CTLFLAG_RW,
"Maximum number of sockets avaliable");
/*
* Initialise maxsockets.
* Initialise maxsockets. This SYSINIT must be run after
* tunable_mbinit().
*/
static void
init_maxsockets(void *ignored)