29c29
< __FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 243999 2012-12-07 22:30:30Z pjd $");
---
> __FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 245575 2013-01-17 21:28:31Z andre $");
49a50
> #include <vm/vm_map.h>
107,111c108
< * 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.
< *
< * NB: This has to be done before VM init.
---
> * tunable_mbinit() has to be run before any mbuf allocations are done.
115a113
> quad_t realmem, maxmbufmem;
116a115,126
> /*
> * The default limit for all mbuf related memory is 1/2 of all
> * available kernel memory (physical or kmem).
> * At most it can be 3/4 of available kernel memory.
> */
> realmem = qmin((quad_t)physmem * PAGE_SIZE,
> vm_map_max(kernel_map) - vm_map_min(kernel_map));
> maxmbufmem = realmem / 2;
> TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem);
> if (maxmbufmem > realmem / 4 * 3)
> maxmbufmem = realmem / 4 * 3;
>
142c152
< SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_mbinit, NULL);
---
> SYSINIT(tunable_mbinit, SI_SUB_KMEM, SI_ORDER_MIDDLE, tunable_mbinit, NULL);
282d291
< static void mbuf_init(void *);
285c294
< /* Ensure that MSIZE must be a power of 2. */
---
> /* Ensure that MSIZE is a power of 2. */
291d299
< SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL);
398a407
> SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL);
< __FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 243999 2012-12-07 22:30:30Z pjd $");
---
> __FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 245575 2013-01-17 21:28:31Z andre $");
49a50
> #include <vm/vm_map.h>
107,111c108
< * 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.
< *
< * NB: This has to be done before VM init.
---
> * tunable_mbinit() has to be run before any mbuf allocations are done.
115a113
> quad_t realmem, maxmbufmem;
116a115,126
> /*
> * The default limit for all mbuf related memory is 1/2 of all
> * available kernel memory (physical or kmem).
> * At most it can be 3/4 of available kernel memory.
> */
> realmem = qmin((quad_t)physmem * PAGE_SIZE,
> vm_map_max(kernel_map) - vm_map_min(kernel_map));
> maxmbufmem = realmem / 2;
> TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem);
> if (maxmbufmem > realmem / 4 * 3)
> maxmbufmem = realmem / 4 * 3;
>
142c152
< SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_mbinit, NULL);
---
> SYSINIT(tunable_mbinit, SI_SUB_KMEM, SI_ORDER_MIDDLE, tunable_mbinit, NULL);
282d291
< static void mbuf_init(void *);
285c294
< /* Ensure that MSIZE must be a power of 2. */
---
> /* Ensure that MSIZE is a power of 2. */
291d299
< SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL);
398a407
> SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbuf_init, NULL);