1/*-
2 * Copyright (c) 2004, 2005,
3 * Bosko Milekic <bmilekic@FreeBSD.org>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 12 unchanged lines hidden (view full) ---
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 185893 2008-12-10 22:17:09Z bz $");
30
31#include "opt_mac.h"
32#include "opt_param.h"
33
34#include <sys/param.h>
35#include <sys/malloc.h>
36#include <sys/systm.h>
37#include <sys/mbuf.h>
--- 58 unchanged lines hidden (view full) ---
96 */
97
98int nmbclusters; /* limits number of mbuf clusters */
99int nmbjumbop; /* limits number of page size jumbo clusters */
100int nmbjumbo9; /* limits number of 9k jumbo clusters */
101int nmbjumbo16; /* limits number of 16k jumbo clusters */
102struct mbstat mbstat;
103
104/*
105 * tunable_mbinit() has to be run before init_maxsockets() thus
106 * the SYSINIT order below is SI_ORDER_MIDDLE while init_maxsockets()
107 * runs at SI_ORDER_ANY.
108 */
109static void
110tunable_mbinit(void *dummy)
111{
112 TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters);
113
114 /* This has to be done before VM init. */
115 if (nmbclusters == 0)
116 nmbclusters = 1024 + maxusers * 64;
117 nmbjumbop = nmbclusters / 2;
118 nmbjumbo9 = nmbjumbop / 2;
119 nmbjumbo16 = nmbjumbo9 / 2;
120}
121SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_mbinit, NULL);
122
123/* XXX: These should be tuneables. Can't change UMA limits on the fly. */
124static int
125sysctl_nmbclusters(SYSCTL_HANDLER_ARGS)
126{
127 int error, newnmbclusters;
128
129 newnmbclusters = nmbclusters;
--- 552 unchanged lines hidden ---
2 * Copyright (c) 2004, 2005,
3 * Bosko Milekic <bmilekic@FreeBSD.org>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 12 unchanged lines hidden (view full) ---
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 185893 2008-12-10 22:17:09Z bz $");
30
31#include "opt_mac.h"
32#include "opt_param.h"
33
34#include <sys/param.h>
35#include <sys/malloc.h>
36#include <sys/systm.h>
37#include <sys/mbuf.h>
--- 58 unchanged lines hidden (view full) ---
96 */
97
98int nmbclusters; /* limits number of mbuf clusters */
99int nmbjumbop; /* limits number of page size jumbo clusters */
100int nmbjumbo9; /* limits number of 9k jumbo clusters */
101int nmbjumbo16; /* limits number of 16k jumbo clusters */
102struct mbstat mbstat;
103
104/*
105 * tunable_mbinit() has to be run before init_maxsockets() thus
106 * the SYSINIT order below is SI_ORDER_MIDDLE while init_maxsockets()
107 * runs at SI_ORDER_ANY.
108 */
109static void
110tunable_mbinit(void *dummy)
111{
112 TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters);
113
114 /* This has to be done before VM init. */
115 if (nmbclusters == 0)
116 nmbclusters = 1024 + maxusers * 64;
117 nmbjumbop = nmbclusters / 2;
118 nmbjumbo9 = nmbjumbop / 2;
119 nmbjumbo16 = nmbjumbo9 / 2;
120}
121SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_mbinit, NULL);
122
123/* XXX: These should be tuneables. Can't change UMA limits on the fly. */
124static int
125sysctl_nmbclusters(SYSCTL_HANDLER_ARGS)
126{
127 int error, newnmbclusters;
128
129 newnmbclusters = nmbclusters;
--- 552 unchanged lines hidden ---