summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/i386/include/vmparam.h3
-rw-r--r--sys/kern/kern_malloc.c5
-rw-r--r--sys/kern/subr_param.c19
-rw-r--r--sys/sys/systm.h1
4 files changed, 10 insertions, 18 deletions
diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h
index e944810..9eaa3f7 100644
--- a/sys/i386/include/vmparam.h
+++ b/sys/i386/include/vmparam.h
@@ -189,7 +189,8 @@
* Ceiling on amount of kmem_map kva space.
*/
#ifndef VM_KMEM_SIZE_MAX
-#define VM_KMEM_SIZE_MAX (320 * 1024 * 1024)
+#define VM_KMEM_SIZE_MAX ((VM_MAX_KERNEL_ADDRESS - \
+ VM_MIN_KERNEL_ADDRESS) * 2 / 5)
#endif
/* initial pagein size of beginning of executable file */
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index a3a9795..7843cae 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -709,11 +709,6 @@ kmeminit(void *dummy)
if (((vm_kmem_size / 2) / PAGE_SIZE) > cnt.v_page_count)
vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE;
- /*
- * Tune settings based on the kmem map's size at this time.
- */
- init_param3(vm_kmem_size / PAGE_SIZE);
-
#ifdef DEBUG_MEMGUARD
tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max);
#else
diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c
index bf72a64..8c13336 100644
--- a/sys/kern/subr_param.c
+++ b/sys/kern/subr_param.c
@@ -48,7 +48,9 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/msgbuf.h>
+#include <vm/vm.h>
#include <vm/vm_param.h>
+#include <vm/pmap.h>
/*
* System parameter formulae.
@@ -293,22 +295,17 @@ init_param2(long physpages)
ncallout = 16 + maxproc + maxfiles;
TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
-}
-
-/*
- * Boot time overrides that are scaled against the kmem map
- */
-void
-init_param3(long kmempages)
-{
/*
- * The default for maxpipekva is max(5% of the kmem map, 512KB).
- * See sys_pipe.c for more details.
+ * The default for maxpipekva is min(1/64 of the kernel address space,
+ * max(1/64 of main memory, 512KB)). See sys_pipe.c for more details.
*/
- maxpipekva = (kmempages / 20) * PAGE_SIZE;
+ maxpipekva = (physpages / 64) * PAGE_SIZE;
if (maxpipekva < 512 * 1024)
maxpipekva = 512 * 1024;
+ if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64)
+ maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) /
+ 64;
TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva);
}
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 39e9e8c..cd1f211 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -171,7 +171,6 @@ void critical_enter(void);
void critical_exit(void);
void init_param1(void);
void init_param2(long physpages);
-void init_param3(long kmempages);
void init_static_kenv(char *, size_t);
void tablefull(const char *);
int kvprintf(char const *, void (*)(int, void*), void *, int,
OpenPOWER on IntegriCloud