diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-09-12 23:05:07 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-09-12 23:05:07 +0000 |
commit | 78151583cdbf7fec9bd8ed3de542bdb1dc8983f4 (patch) | |
tree | d5400b809ffedc93752432bae7ac65f8cdfc56c7 | |
parent | 096dc2b114f3ad0390816a8c4a1af3fb2c427c75 (diff) |
Change the NKMEMPAGES range to 4-64MB for 32bit arches, and 8-128MB for 64bit
arches; except on sparc where the range is 4-8 for !sun4m and 4-64 for sun4m,
selected at runtime.
-rw-r--r-- | sys/arch/arm/include/param.h | 6 | ||||
-rw-r--r-- | sys/arch/hp300/include/param.h | 9 | ||||
-rw-r--r-- | sys/arch/hppa64/include/param.h | 6 | ||||
-rw-r--r-- | sys/arch/m68k/include/param.h | 9 | ||||
-rw-r--r-- | sys/arch/m88k/include/param.h | 4 | ||||
-rw-r--r-- | sys/arch/mac68k/include/param.h | 9 | ||||
-rw-r--r-- | sys/arch/macppc/include/param.h | 10 | ||||
-rw-r--r-- | sys/arch/mips64/include/param.h | 4 | ||||
-rw-r--r-- | sys/arch/mvme68k/include/param.h | 9 | ||||
-rw-r--r-- | sys/arch/mvmeppc/include/param.h | 14 | ||||
-rw-r--r-- | sys/arch/powerpc/include/param.h | 9 | ||||
-rw-r--r-- | sys/arch/solbourne/include/param.h | 6 | ||||
-rw-r--r-- | sys/arch/sparc/include/param.h | 7 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/autoconf.c | 13 | ||||
-rw-r--r-- | sys/arch/sparc64/include/param.h | 4 | ||||
-rw-r--r-- | sys/kern/kern_malloc.c | 31 | ||||
-rw-r--r-- | sys/uvm/uvm_extern.h | 4 |
17 files changed, 76 insertions, 78 deletions
diff --git a/sys/arch/arm/include/param.h b/sys/arch/arm/include/param.h index ae2849e7139..e15b515f22b 100644 --- a/sys/arch/arm/include/param.h +++ b/sys/arch/arm/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.6 2005/07/31 15:31:12 miod Exp $ */ +/* $OpenBSD: param.h,v 1.7 2005/09/12 23:05:03 miod Exp $ */ /* $NetBSD: param.h,v 1.9 2002/03/24 03:37:23 thorpej Exp $ */ /* @@ -65,8 +65,8 @@ * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized * logical pages. */ -#define NKMEMPAGES_MIN_DEFAULT ((6 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((7 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) /* Constants used to divide the USPACE area */ diff --git a/sys/arch/hp300/include/param.h b/sys/arch/hp300/include/param.h index 20e3a05a658..502bd44ea0f 100644 --- a/sys/arch/hp300/include/param.h +++ b/sys/arch/hp300/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.23 2003/06/02 23:27:45 millert Exp $ */ +/* $OpenBSD: param.h,v 1.24 2005/09/12 23:05:05 miod Exp $ */ /* $NetBSD: param.h,v 1.35 1997/07/10 08:22:38 veego Exp $ */ /* @@ -65,13 +65,6 @@ #define NPTEPG (NBPG/(sizeof (pt_entry_t))) -/* - * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized - * logical pages. - */ -#define NKMEMPAGES_MIN_DEFAULT ((2 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((2 * 1024 * 1024) >> PAGE_SHIFT) - #define MSGBUFSIZE 4096 #if defined(_KERNEL) && !defined(_LOCORE) diff --git a/sys/arch/hppa64/include/param.h b/sys/arch/hppa64/include/param.h index d06caf51653..2fe2d417f37 100644 --- a/sys/arch/hppa64/include/param.h +++ b/sys/arch/hppa64/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.2 2005/07/31 15:31:13 miod Exp $ */ +/* $OpenBSD: param.h,v 1.3 2005/09/12 23:05:05 miod Exp $ */ /* * Copyright (c) 1988-1994, The University of Utah and @@ -86,8 +86,8 @@ * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized * logical pages. */ -#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) /* pages ("clicks") (4096 bytes) to disk blocks */ #define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT)) diff --git a/sys/arch/m68k/include/param.h b/sys/arch/m68k/include/param.h index 6f76e898fde..f5fe631af62 100644 --- a/sys/arch/m68k/include/param.h +++ b/sys/arch/m68k/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.12 2005/09/12 09:59:51 martin Exp $ */ +/* $OpenBSD: param.h,v 1.13 2005/09/12 23:05:05 miod Exp $ */ /* $NetBSD: param.h,v 1.2 1997/06/10 18:21:23 veego Exp $ */ /* @@ -92,6 +92,13 @@ #define USPACE_ALIGN (0) /* u-area alignment 0-none */ /* + * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized + * logical pages. + */ +#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) + +/* * Constants related to network buffer management. * MCLBYTES must be no larger than CLBYTES (the software page size), and, * on machines that exchange pages of input or output buffers with mbuf diff --git a/sys/arch/m88k/include/param.h b/sys/arch/m88k/include/param.h index 5e537ffdad6..c86f46cbc6e 100644 --- a/sys/arch/m88k/include/param.h +++ b/sys/arch/m88k/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.5 2005/07/31 15:31:14 miod Exp $ */ +/* $OpenBSD: param.h,v 1.6 2005/09/12 23:05:05 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1988 University of Utah. @@ -102,7 +102,7 @@ * logical pages. */ #define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) #define MSGBUFSIZE PAGE_SIZE diff --git a/sys/arch/mac68k/include/param.h b/sys/arch/mac68k/include/param.h index 21a71052091..0f9ecba6180 100644 --- a/sys/arch/mac68k/include/param.h +++ b/sys/arch/mac68k/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.19 2003/06/02 23:27:49 millert Exp $ */ +/* $OpenBSD: param.h,v 1.20 2005/09/12 23:05:05 miod Exp $ */ /* $NetBSD: param.h,v 1.28 1997/03/01 06:57:45 scottr Exp $ */ /* @@ -100,13 +100,6 @@ #define NPTEPG (NBPG/(sizeof (pt_entry_t))) -/* - * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized - * logical pages. - */ -#define NKMEMPAGES_MIN_DEFAULT ((3 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((3 * 1024 * 1024) >> PAGE_SHIFT) - #define MSGBUFSIZE 4096 #if defined(_KERNEL) && !defined(_LOCORE) diff --git a/sys/arch/macppc/include/param.h b/sys/arch/macppc/include/param.h index f47602547e9..709e1de4486 100644 --- a/sys/arch/macppc/include/param.h +++ b/sys/arch/macppc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.3 2001/12/05 17:08:32 drahn Exp $ */ +/* $OpenBSD: param.h,v 1.4 2005/09/12 23:05:05 miod Exp $ */ /* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ /*- @@ -49,11 +49,3 @@ #define KERNBASE 0x100000 #define MSGBUFSIZE (NBPG*2) - -/* - * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized - * logical pages. - */ -#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((16 * 1024 * 1024) >> PAGE_SHIFT) - diff --git a/sys/arch/mips64/include/param.h b/sys/arch/mips64/include/param.h index 6aaf7549419..ab0ce4b99af 100644 --- a/sys/arch/mips64/include/param.h +++ b/sys/arch/mips64/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.8 2005/08/07 07:29:44 miod Exp $ */ +/* $OpenBSD: param.h,v 1.9 2005/09/12 23:05:05 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -112,7 +112,7 @@ /* Default malloc arena size */ #define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) /* pages ("clicks") (4096 bytes) to disk blocks */ #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) diff --git a/sys/arch/mvme68k/include/param.h b/sys/arch/mvme68k/include/param.h index 626a20c5c88..c7a54728588 100644 --- a/sys/arch/mvme68k/include/param.h +++ b/sys/arch/mvme68k/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.19 2003/06/02 23:27:50 millert Exp $ */ +/* $OpenBSD: param.h,v 1.20 2005/09/12 23:05:05 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -61,13 +61,6 @@ #include <m68k/param.h> /* - * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized - * logical pages. - */ -#define NKMEMPAGES_MIN_DEFAULT ((2 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((2 * 1024 * 1024) >> PAGE_SHIFT) - -/* * spl functions; all but spl0 are done in-line */ #include <machine/psl.h> diff --git a/sys/arch/mvmeppc/include/param.h b/sys/arch/mvmeppc/include/param.h index 6505b73ddc8..e10f2bae165 100644 --- a/sys/arch/mvmeppc/include/param.h +++ b/sys/arch/mvmeppc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.4 2001/12/05 01:57:15 provos Exp $ */ +/* $OpenBSD: param.h,v 1.5 2005/09/12 23:05:05 miod Exp $ */ /* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ /*- @@ -49,15 +49,3 @@ #define KERNBASE 0x100000 #define MSGBUFSIZE (NBPG*2) - -/* - * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized - * logical pages. - */ -#ifndef NKMEMPAGES_MIN_DEFAULT -#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) -#endif -#ifndef NKMEMPAGES_MAX_DEFAULT -#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) -#endif - diff --git a/sys/arch/powerpc/include/param.h b/sys/arch/powerpc/include/param.h index 75c62bc7a40..e733b223c3d 100644 --- a/sys/arch/powerpc/include/param.h +++ b/sys/arch/powerpc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.25 2004/08/06 22:31:31 mickey Exp $ */ +/* $OpenBSD: param.h,v 1.26 2005/09/12 23:05:05 miod Exp $ */ /* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ /*- @@ -70,6 +70,13 @@ #define USPACE_ALIGN (0) /* u-area alignment 0-none */ /* + * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized + * logical pages. + */ +#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) + +/* * Constants related to network buffer management. * MCLBYTES must be no larger than the software page size, and, * on machines that exchange pages of input or output buffers with mbuf diff --git a/sys/arch/solbourne/include/param.h b/sys/arch/solbourne/include/param.h index 2b9a9b92425..fce54c30d5a 100644 --- a/sys/arch/solbourne/include/param.h +++ b/sys/arch/solbourne/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.2 2005/07/31 15:31:16 miod Exp $ */ +/* $OpenBSD: param.h,v 1.3 2005/09/12 23:05:05 miod Exp $ */ /* OpenBSD: param.h,v 1.29 2004/08/06 22:31:31 mickey Exp */ /* @@ -105,8 +105,8 @@ * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized * logical pages. */ -#define NKMEMPAGES_MIN_DEFAULT ((6 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((6 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) /* pages ("clicks") to disk blocks */ #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h index 1063d837476..5987f2050c6 100644 --- a/sys/arch/sparc/include/param.h +++ b/sys/arch/sparc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.30 2005/07/31 15:31:17 miod Exp $ */ +/* $OpenBSD: param.h,v 1.31 2005/09/12 23:05:05 miod Exp $ */ /* $NetBSD: param.h,v 1.29 1997/03/10 22:50:37 pk Exp $ */ /* @@ -109,8 +109,9 @@ * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized * logical pages. */ -#define NKMEMPAGES_MIN_DEFAULT ((6 * 1024 * 1024) >> PAGE_SHIFT) -#define NKMEMPAGES_MAX_DEFAULT ((6 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT_SUN4M ((64 * 1024 * 1024) >> PAGE_SHIFT) /* pages ("clicks") to disk blocks */ #define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) diff --git a/sys/arch/sparc/sparc/autoconf.c b/sys/arch/sparc/sparc/autoconf.c index 357ef31b836..351c267fbb6 100644 --- a/sys/arch/sparc/sparc/autoconf.c +++ b/sys/arch/sparc/sparc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.67 2005/05/01 18:15:46 miod Exp $ */ +/* $OpenBSD: autoconf.c,v 1.68 2005/09/12 23:05:05 miod Exp $ */ /* $NetBSD: autoconf.c,v 1.73 1997/07/29 09:41:53 fair Exp $ */ /* @@ -221,6 +221,17 @@ bootstrap() ddb_init(); #endif +#if defined(SUN4M) + /* + * Allow a larger kernel malloc space on sun4m. + */ + if (CPU_ISSUN4M) { + extern u_int nkmempages_max; + + nkmempages_max = NKMEMPAGES_MAX_DEFAULT_SUN4M; + } +#endif + /* * On sun4ms we have to do some nasty stuff here. We need to map * in the interrupt registers (since we need to find out where diff --git a/sys/arch/sparc64/include/param.h b/sys/arch/sparc64/include/param.h index d9927ce3924..a08ae38c613 100644 --- a/sys/arch/sparc64/include/param.h +++ b/sys/arch/sparc64/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.17 2005/09/08 15:25:55 martin Exp $ */ +/* $OpenBSD: param.h,v 1.18 2005/09/12 23:05:06 miod Exp $ */ /* $NetBSD: param.h,v 1.25 2001/05/30 12:28:51 mrg Exp $ */ /* @@ -191,7 +191,7 @@ extern int nbpg, pgofset, pgshift; * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized * logical pages. */ -#define NKMEMPAGES_MIN_DEFAULT ((6 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MIN_DEFAULT ((8 * 1024 * 1024) >> PAGE_SHIFT) #define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) /* pages ("clicks") to disk blocks */ diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index c4825e43e88..0683bb348b3 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.59 2004/12/30 08:28:39 niklas Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.60 2005/09/12 23:05:06 miod Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -56,7 +56,7 @@ struct vm_map *kmem_map = NULL; #ifndef NKMEMPAGES #define NKMEMPAGES 0 #endif -int nkmempages = NKMEMPAGES; +u_int nkmempages = NKMEMPAGES; /* * Defaults for lower- and upper-bounds for the kmem_map page count. @@ -65,10 +65,12 @@ int nkmempages = NKMEMPAGES; #ifndef NKMEMPAGES_MIN #define NKMEMPAGES_MIN NKMEMPAGES_MIN_DEFAULT #endif +u_int nkmempages_min = 0; #ifndef NKMEMPAGES_MAX #define NKMEMPAGES_MAX NKMEMPAGES_MAX_DEFAULT #endif +u_int nkmempages_max = 0; struct kmembuckets bucket[MINBUCKET + 16]; struct kmemstats kmemstats[M_LAST]; @@ -435,7 +437,7 @@ free(addr, type) void kmeminit_nkmempages() { - int npages; + u_int npages; if (nkmempages != 0) { /* @@ -446,21 +448,32 @@ kmeminit_nkmempages() } /* + * We can't initialize these variables at compilation time, since + * the page size may not be known (on sparc GENERIC kernels, for + * example). But we still want the MD code to be able to provide + * better values. + */ + if (nkmempages_min == 0) + nkmempages_min = NKMEMPAGES_MIN; + if (nkmempages_max == 0) + nkmempages_max = NKMEMPAGES_MAX; + + /* * We use the following (simple) formula: * * - Starting point is physical memory / 4. * - * - Clamp it down to NKMEMPAGES_MAX. + * - Clamp it down to nkmempages_max. * - * - Round it up to NKMEMPAGES_MIN. + * - Round it up to nkmempages_min. */ npages = physmem / 4; - if (npages > NKMEMPAGES_MAX) - npages = NKMEMPAGES_MAX; + if (npages > nkmempages_max) + npages = nkmempages_max; - if (npages < NKMEMPAGES_MIN) - npages = NKMEMPAGES_MIN; + if (npages < nkmempages_min) + npages = nkmempages_min; nkmempages = npages; } diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index fe93ea4ad4c..a65dff88d1f 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.56 2005/05/24 21:11:47 tedu Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.57 2005/09/12 23:05:06 miod Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -603,7 +603,7 @@ struct uvm_object *uvn_attach(void *, vm_prot_t); /* kern_malloc.c */ void kmeminit_nkmempages(void); void kmeminit(void); -extern int nkmempages; +extern u_int nkmempages; #endif /* _KERNEL */ |