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 184778 2008-11-09 01:53:06Z kmacy $");
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
104static void
105tunable_mbinit(void *dummy)
106{
107 TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters);
108
109 /* This has to be done before VM init. */
110 if (nmbclusters == 0)
111 nmbclusters = 1024 + maxusers * 64;
112 nmbjumbop = nmbclusters / 2;
113 nmbjumbo9 = nmbjumbop / 2;
114 nmbjumbo16 = nmbjumbo9 / 2;
115}
116SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_ANY, tunable_mbinit, NULL);
117
118/* XXX: These should be tuneables. Can't change UMA limits on the fly. */
119static int
120sysctl_nmbclusters(SYSCTL_HANDLER_ARGS)
121{
122 int error, newnmbclusters;
123
124 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 184778 2008-11-09 01:53:06Z kmacy $");
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
104static void
105tunable_mbinit(void *dummy)
106{
107 TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters);
108
109 /* This has to be done before VM init. */
110 if (nmbclusters == 0)
111 nmbclusters = 1024 + maxusers * 64;
112 nmbjumbop = nmbclusters / 2;
113 nmbjumbo9 = nmbjumbop / 2;
114 nmbjumbo16 = nmbjumbo9 / 2;
115}
116SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_ANY, tunable_mbinit, NULL);
117
118/* XXX: These should be tuneables. Can't change UMA limits on the fly. */
119static int
120sysctl_nmbclusters(SYSCTL_HANDLER_ARGS)
121{
122 int error, newnmbclusters;
123
124 newnmbclusters = nmbclusters;
--- 552 unchanged lines hidden ---