summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-09-19 04:39:08 +0000
committerjeff <jeff@FreeBSD.org>2003-09-19 04:39:08 +0000
commit52b3368d79ea61645b6f3476134b7517b560a346 (patch)
tree2a75626378e357ca691a2b41a24e9570b1ecc122 /sys/kern/kern_malloc.c
parent4dc951119b71c3c4e820330aa0a573cb14781f26 (diff)
downloadFreeBSD-src-52b3368d79ea61645b6f3476134b7517b560a346.zip
FreeBSD-src-52b3368d79ea61645b6f3476134b7517b560a346.tar.gz
- Only use UMA to cache malloc requests up to PAGE_SIZE. Values larger than
this are requested very infrequently and waste memory when we cache spares.
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index a90d628..62fc909 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -95,7 +95,7 @@ static char *kmemlimit;
#define KMEM_ZBASE 16
#define KMEM_ZMASK (KMEM_ZBASE - 1)
-#define KMEM_ZMAX 65536
+#define KMEM_ZMAX PAGE_SIZE
#define KMEM_ZSIZE (KMEM_ZMAX >> KMEM_ZSHIFT)
static u_int8_t kmemsize[KMEM_ZSIZE + 1];
@@ -114,10 +114,21 @@ struct {
{1024, "1024", NULL},
{2048, "2048", NULL},
{4096, "4096", NULL},
+#if PAGE_SIZE > 4096
{8192, "8192", NULL},
+#if PAGE_SIZE > 8192
{16384, "16384", NULL},
+#if PAGE_SIZE > 16384
{32768, "32768", NULL},
+#if PAGE_SIZE > 32768
{65536, "65536", NULL},
+#if PAGE_SIZE > 65536
+#error "Unsupported PAGE_SIZE"
+#endif /* 65536 */
+#endif /* 32768 */
+#endif /* 16384 */
+#endif /* 8192 */
+#endif /* 4096 */
{0, NULL},
};
OpenPOWER on IntegriCloud