diff options
author | msmith <msmith@FreeBSD.org> | 1999-07-05 08:52:54 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1999-07-05 08:52:54 +0000 |
commit | af7615d39a0a05294c977a44b96e0abd75a0e723 (patch) | |
tree | d39acb1756b5a1342da8e9e7436ed7232c818bf1 /sys | |
parent | 36e6752409ff0942f4248605bd0089086ffb9dfe (diff) | |
download | FreeBSD-src-af7615d39a0a05294c977a44b96e0abd75a0e723.zip FreeBSD-src-af7615d39a0a05294c977a44b96e0abd75a0e723.tar.gz |
Move the initialisation/tuning of nmbclusters from param.c/machdep.c
into uipc_mbuf.c. This reduces three sets of identical tunable code to
one set, and puts the initialisation with the mbuf code proper.
Make NMBUFs tunable as well.
Move the nmbclusters sysctl here as well.
Move the initialisation of maxsockets from param.c to uipc_socket2.c,
next to its corresponding sysctl.
Use the new tunable macros for the kern.vm.kmem.size tunable (this should have
been in a separate commit, whoops).
Diffstat (limited to 'sys')
-rw-r--r-- | sys/alpha/alpha/machdep.c | 8 | ||||
-rw-r--r-- | sys/amd64/amd64/machdep.c | 8 | ||||
-rw-r--r-- | sys/conf/param.c | 18 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 8 | ||||
-rw-r--r-- | sys/kern/kern_malloc.c | 15 | ||||
-rw-r--r-- | sys/kern/subr_param.c | 18 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 12 | ||||
-rw-r--r-- | sys/kern/uipc_sockbuf.c | 17 | ||||
-rw-r--r-- | sys/kern/uipc_socket2.c | 17 | ||||
-rw-r--r-- | sys/pc98/i386/machdep.c | 8 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 8 |
11 files changed, 53 insertions, 84 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index f251e78..7fe9514 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: machdep.c,v 1.44 1999/06/08 16:42:14 dt Exp $ + * $Id: machdep.c,v 1.45 1999/06/10 20:40:53 dt Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -389,12 +389,6 @@ again: */ { vm_offset_t mb_map_size; - int xclusters; - - /* Allow override of NMBCLUSTERS from the kernel environment */ - if (getenv_int("kern.ipc.nmbclusters", &xclusters) && - xclusters > nmbclusters) - nmbclusters = xclusters; mb_map_size = nmbufs * MSIZE + nmbclusters * MCLBYTES; mb_map_size = roundup2(mb_map_size, max(MCLBYTES, PAGE_SIZE)); diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 34b9c8e..54c72fc 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.350 1999/07/04 00:25:17 mckusick Exp $ + * $Id: machdep.c,v 1.351 1999/07/04 02:26:23 jlemon Exp $ */ #include "apm.h" @@ -390,12 +390,6 @@ again: */ { vm_offset_t mb_map_size; - int xclusters; - - /* Allow override of NMBCLUSTERS from the kernel environment */ - if (getenv_int("kern.ipc.nmbclusters", &xclusters) && - xclusters > nmbclusters) - nmbclusters = xclusters; mb_map_size = nmbufs * MSIZE + nmbclusters * MCLBYTES; mb_map_size = roundup2(mb_map_size, max(MCLBYTES, PAGE_SIZE)); diff --git a/sys/conf/param.c b/sys/conf/param.c index ce003d9..b9a9062 100644 --- a/sys/conf/param.c +++ b/sys/conf/param.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.c 8.3 (Berkeley) 8/20/94 - * $Id: param.c,v 1.32 1998/12/14 08:34:54 dillon Exp $ + * $Id: param.c,v 1.33 1999/04/09 16:28:11 des Exp $ */ #include <stddef.h> @@ -83,22 +83,6 @@ int maxfiles = MAXFILES; /* system wide open files limit */ int maxfilesperproc = MAXFILES; /* per-process open files limit */ int ncallout = 16 + NPROC + MAXFILES; /* maximum # of timer events */ -/* maximum # of mbuf clusters */ -#ifndef NMBCLUSTERS -#define NMBCLUSTERS (512 + MAXUSERS * 16) -#endif -int nmbclusters = NMBCLUSTERS; - -#if MAXFILES > NMBCLUSTERS -#define MAXSOCKETS MAXFILES -#else -#define MAXSOCKETS NMBCLUSTERS -#endif -int maxsockets = MAXSOCKETS; - -/* allocate 1/4th amount of virtual address space for mbufs XXX */ -int nmbufs = NMBCLUSTERS * 4; - /* maximum # of sf_bufs (sendfile(2) zero-copy virtual buffers) */ #ifndef NSFBUFS #define NSFBUFS (512 + MAXUSERS * 16) diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 34b9c8e..54c72fc 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.350 1999/07/04 00:25:17 mckusick Exp $ + * $Id: machdep.c,v 1.351 1999/07/04 02:26:23 jlemon Exp $ */ #include "apm.h" @@ -390,12 +390,6 @@ again: */ { vm_offset_t mb_map_size; - int xclusters; - - /* Allow override of NMBCLUSTERS from the kernel environment */ - if (getenv_int("kern.ipc.nmbclusters", &xclusters) && - xclusters > nmbclusters) - nmbclusters = xclusters; mb_map_size = nmbufs * MSIZE + nmbclusters * MCLBYTES; mb_map_size = roundup2(mb_map_size, max(MCLBYTES, PAGE_SIZE)); diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 0b300c2..4b3a42a 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 - * $Id: kern_malloc.c,v 1.55 1999/05/06 18:12:42 peter Exp $ + * $Id: kern_malloc.c,v 1.56 1999/05/12 11:11:27 bde Exp $ */ #include "opt_vm.h" @@ -419,22 +419,21 @@ kmeminit(dummy) * Note that the kmem_map is also used by the zone allocator, * so make sure that there is enough space. */ - vm_kmem_size = VM_KMEM_SIZE; + xvm_kmem_size = VM_KMEM_SIZE; mem_size = cnt.v_page_count * PAGE_SIZE; #if defined(VM_KMEM_SIZE_SCALE) - if ((mem_size / VM_KMEM_SIZE_SCALE) > vm_kmem_size) - vm_kmem_size = mem_size / VM_KMEM_SIZE_SCALE; + if ((mem_size / VM_KMEM_SIZE_SCALE) > xvm_kmem_size) + xvm_kmem_size = mem_size / VM_KMEM_SIZE_SCALE; #endif #if defined(VM_KMEM_SIZE_MAX) - if (vm_kmem_size >= VM_KMEM_SIZE_MAX) - vm_kmem_size = VM_KMEM_SIZE_MAX; + if (xvm_kmem_size >= VM_KMEM_SIZE_MAX) + xvm_kmem_size = VM_KMEM_SIZE_MAX; #endif /* Allow final override from the kernel environment */ - if (getenv_int("kern.vm.kmem.size", &xvm_kmem_size)) - vm_kmem_size = xvm_kmem_size; + TUNABLE_INT_FETCH("kern.vm.kmem.size", xvm_kmem_size, vm_kmem_size); if (vm_kmem_size > 2 * (cnt.v_page_count * PAGE_SIZE)) vm_kmem_size = 2 * (cnt.v_page_count * PAGE_SIZE); diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index ce003d9..b9a9062 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.c 8.3 (Berkeley) 8/20/94 - * $Id: param.c,v 1.32 1998/12/14 08:34:54 dillon Exp $ + * $Id: param.c,v 1.33 1999/04/09 16:28:11 des Exp $ */ #include <stddef.h> @@ -83,22 +83,6 @@ int maxfiles = MAXFILES; /* system wide open files limit */ int maxfilesperproc = MAXFILES; /* per-process open files limit */ int ncallout = 16 + NPROC + MAXFILES; /* maximum # of timer events */ -/* maximum # of mbuf clusters */ -#ifndef NMBCLUSTERS -#define NMBCLUSTERS (512 + MAXUSERS * 16) -#endif -int nmbclusters = NMBCLUSTERS; - -#if MAXFILES > NMBCLUSTERS -#define MAXSOCKETS MAXFILES -#else -#define MAXSOCKETS NMBCLUSTERS -#endif -int maxsockets = MAXSOCKETS; - -/* allocate 1/4th amount of virtual address space for mbufs XXX */ -int nmbufs = NMBCLUSTERS * 4; - /* maximum # of sf_bufs (sendfile(2) zero-copy virtual buffers) */ #ifndef NSFBUFS #define NSFBUFS (512 + MAXUSERS * 16) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index d7e0de7..92505fb 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -31,9 +31,10 @@ * SUCH DAMAGE. * * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 - * $Id: uipc_mbuf.c,v 1.39 1999/04/12 10:07:15 des Exp $ + * $Id: uipc_mbuf.c,v 1.40 1999/07/01 13:21:39 peter Exp $ */ +#include "opt_param.h" #include <sys/param.h> #include <sys/systm.h> #include <sys/malloc.h> @@ -59,6 +60,8 @@ int max_linkhdr; int max_protohdr; int max_hdr; int max_datalen; +int nmbclusters; +int nmbufs; SYSCTL_DECL(_kern_ipc); SYSCTL_INT(_kern_ipc, KIPC_MAX_LINKHDR, max_linkhdr, CTLFLAG_RW, @@ -69,6 +72,13 @@ SYSCTL_INT(_kern_ipc, KIPC_MAX_HDR, max_hdr, CTLFLAG_RW, &max_hdr, 0, ""); SYSCTL_INT(_kern_ipc, KIPC_MAX_DATALEN, max_datalen, CTLFLAG_RW, &max_datalen, 0, ""); SYSCTL_STRUCT(_kern_ipc, KIPC_MBSTAT, mbstat, CTLFLAG_RW, &mbstat, mbstat, ""); +SYSCTL_INT(_kern_ipc, KIPC_NMBCLUSTERS, nmbclusters, CTLFLAG_RD, + &nmbclusters, 0, "Maximum number of mbuf clusters avaliable"); +#ifndef NMBCLUSTERS +#define NMBCLUSTERS (512 + MAXUSERS * 16) +#endif +TUNABLE_INT_DECL("kern.ipc.nmbclusters", NMBCLUSTERS, nmbclusters); +TUNABLE_INT_DECL("kern.ipc.nmbufs", NMBCLUSTERS * 4, nmbufs); /* XXX fixup? */ static void m_reclaim __P((void)); diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 2583e3b..14d73c3 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -31,12 +31,14 @@ * SUCH DAMAGE. * * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 - * $Id: uipc_socket2.c,v 1.46 1999/05/10 18:15:40 peter Exp $ + * $Id: uipc_socket2.c,v 1.47 1999/06/17 23:54:48 green Exp $ */ +#include "opt_param.h" #include <sys/param.h> #include <sys/systm.h> #include <sys/domain.h> +#include <sys/file.h> /* for maxfiles */ #include <sys/kernel.h> #include <sys/proc.h> #include <sys/malloc.h> @@ -48,6 +50,8 @@ #include <sys/signalvar.h> #include <sys/sysctl.h> +int maxsockets; + /* * Primitive routines for operating on sockets and socket buffers */ @@ -954,6 +958,13 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, maxsockets, CTLFLAG_RD, &maxsockets, 0, "Maximum number of sockets avaliable"); SYSCTL_INT(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW, &sb_efficiency, 0, ""); -SYSCTL_INT(_kern_ipc, KIPC_NMBCLUSTERS, nmbclusters, CTLFLAG_RD, - &nmbclusters, 0, "Maximum number of mbuf clusters avaliable"); +/* + * Initialise maxsockets + */ +static void init_maxsockets(void *ignored) +{ + TUNABLE_INT_FETCH("kern.ipc.maxsockets", 0, maxsockets); + maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); +} +SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL); diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 2583e3b..14d73c3 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -31,12 +31,14 @@ * SUCH DAMAGE. * * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 - * $Id: uipc_socket2.c,v 1.46 1999/05/10 18:15:40 peter Exp $ + * $Id: uipc_socket2.c,v 1.47 1999/06/17 23:54:48 green Exp $ */ +#include "opt_param.h" #include <sys/param.h> #include <sys/systm.h> #include <sys/domain.h> +#include <sys/file.h> /* for maxfiles */ #include <sys/kernel.h> #include <sys/proc.h> #include <sys/malloc.h> @@ -48,6 +50,8 @@ #include <sys/signalvar.h> #include <sys/sysctl.h> +int maxsockets; + /* * Primitive routines for operating on sockets and socket buffers */ @@ -954,6 +958,13 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, maxsockets, CTLFLAG_RD, &maxsockets, 0, "Maximum number of sockets avaliable"); SYSCTL_INT(_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW, &sb_efficiency, 0, ""); -SYSCTL_INT(_kern_ipc, KIPC_NMBCLUSTERS, nmbclusters, CTLFLAG_RD, - &nmbclusters, 0, "Maximum number of mbuf clusters avaliable"); +/* + * Initialise maxsockets + */ +static void init_maxsockets(void *ignored) +{ + TUNABLE_INT_FETCH("kern.ipc.maxsockets", 0, maxsockets); + maxsockets = imax(maxsockets, imax(maxfiles, nmbclusters)); +} +SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL); diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 791b098..56cd258 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.122 1999/06/30 13:30:10 kato Exp $ + * $Id: machdep.c,v 1.123 1999/07/03 08:31:32 kato Exp $ */ #include "apm.h" @@ -401,12 +401,6 @@ again: */ { vm_offset_t mb_map_size; - int xclusters; - - /* Allow override of NMBCLUSTERS from the kernel environment */ - if (getenv_int("kern.ipc.nmbclusters", &xclusters) && - xclusters > nmbclusters) - nmbclusters = xclusters; mb_map_size = nmbufs * MSIZE + nmbclusters * MCLBYTES; mb_map_size = roundup2(mb_map_size, max(MCLBYTES, PAGE_SIZE)); diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 791b098..56cd258 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.122 1999/06/30 13:30:10 kato Exp $ + * $Id: machdep.c,v 1.123 1999/07/03 08:31:32 kato Exp $ */ #include "apm.h" @@ -401,12 +401,6 @@ again: */ { vm_offset_t mb_map_size; - int xclusters; - - /* Allow override of NMBCLUSTERS from the kernel environment */ - if (getenv_int("kern.ipc.nmbclusters", &xclusters) && - xclusters > nmbclusters) - nmbclusters = xclusters; mb_map_size = nmbufs * MSIZE + nmbclusters * MCLBYTES; mb_map_size = roundup2(mb_map_size, max(MCLBYTES, PAGE_SIZE)); |