Deleted Added
full compact
kern_mbuf.c (184778) kern_mbuf.c (185893)
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>
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 $");
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
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 */
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}
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}
116SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_ANY, tunable_mbinit, NULL);
121SYSINIT(tunable_mbinit, SI_SUB_TUNABLES, SI_ORDER_MIDDLE, 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 ---
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 ---