summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsepotvin <sepotvin@FreeBSD.org>2007-04-21 01:14:48 +0000
committersepotvin <sepotvin@FreeBSD.org>2007-04-21 01:14:48 +0000
commita1e73b1eafb356ff4adba96fd8099c15c11471cd (patch)
tree7a4cb32527ec0601ac8912d8ef1baa9431ee0a67 /sys
parenta1cba020dddfbcf1bcb0f4124b38e2255f16bdc9 (diff)
downloadFreeBSD-src-a1e73b1eafb356ff4adba96fd8099c15c11471cd.zip
FreeBSD-src-a1e73b1eafb356ff4adba96fd8099c15c11471cd.tar.gz
Add support for specifying a minimal size for vm.kmem_size in the loader via
vm.kmem_size_min. Useful when using ZFS to make sure that vm.kmem size will be at least 256mb (for example) without forcing a particular value via vm.kmem_size. Approved by: njl (mentor) Reviewed by: alc
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/include/vmparam.h3
-rw-r--r--sys/i386/include/vmparam.h3
-rw-r--r--sys/ia64/include/vmparam.h3
-rw-r--r--sys/kern/kern_malloc.c12
-rw-r--r--sys/sparc64/include/vmparam.h3
-rw-r--r--sys/sun4v/include/vmparam.h3
6 files changed, 22 insertions, 5 deletions
diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h
index 954cebc..47e111c 100644
--- a/sys/amd64/include/vmparam.h
+++ b/sys/amd64/include/vmparam.h
@@ -122,7 +122,8 @@
/*
* How many physical pages per KVA page allocated.
- * min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
+ * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE),
+ * VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX)
* is the total KVA space allocated for kmem_map.
*/
#ifndef VM_KMEM_SIZE_SCALE
diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h
index 53c3f45..042470e 100644
--- a/sys/i386/include/vmparam.h
+++ b/sys/i386/include/vmparam.h
@@ -117,7 +117,8 @@
/*
* How many physical pages per KVA page allocated.
- * min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
+ * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE),
+ * VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX)
* is the total KVA space allocated for kmem_map.
*/
#ifndef VM_KMEM_SIZE_SCALE
diff --git a/sys/ia64/include/vmparam.h b/sys/ia64/include/vmparam.h
index 06ae7c3..8beeb2a 100644
--- a/sys/ia64/include/vmparam.h
+++ b/sys/ia64/include/vmparam.h
@@ -155,7 +155,8 @@
/*
* How many physical pages per KVA page allocated.
- * min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
+ * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE),
+ * VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX)
* is the total KVA space allocated for kmem_map.
*/
#ifndef VM_KMEM_SIZE_SCALE
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index b05d13a..19fbf30 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -178,6 +178,10 @@ u_int vm_kmem_size;
SYSCTL_UINT(_vm, OID_AUTO, kmem_size, CTLFLAG_RD, &vm_kmem_size, 0,
"Size of kernel memory");
+u_int vm_kmem_size_min;
+SYSCTL_UINT(_vm, OID_AUTO, kmem_size_min, CTLFLAG_RD, &vm_kmem_size_min, 0,
+ "Minimum size of kernel memory");
+
u_int vm_kmem_size_max;
SYSCTL_UINT(_vm, OID_AUTO, kmem_size_max, CTLFLAG_RD, &vm_kmem_size_max, 0,
"Maximum size of kernel memory");
@@ -557,6 +561,14 @@ kmeminit(void *dummy)
(mem_size / vm_kmem_size_scale) > (vm_kmem_size / PAGE_SIZE))
vm_kmem_size = (mem_size / vm_kmem_size_scale) * PAGE_SIZE;
+#if defined(VM_KMEM_SIZE_MIN)
+ vm_kmem_size_min = VM_KMEM_SIZE_MIN;
+#endif
+ TUNABLE_INT_FETCH("vm.kmem_size_min", &vm_kmem_size_min);
+ if (vm_kmem_size_min > 0 && vm_kmem_size < vm_kmem_size_min) {
+ vm_kmem_size = vm_kmem_size_min;
+ }
+
#if defined(VM_KMEM_SIZE_MAX)
vm_kmem_size_max = VM_KMEM_SIZE_MAX;
#endif
diff --git a/sys/sparc64/include/vmparam.h b/sys/sparc64/include/vmparam.h
index de4112b..99a9527 100644
--- a/sys/sparc64/include/vmparam.h
+++ b/sys/sparc64/include/vmparam.h
@@ -163,7 +163,8 @@
/*
* How many physical pages per KVA page allocated.
- * min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
+ * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE),
+ * VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX)
* is the total KVA space allocated for kmem_map.
*/
#ifndef VM_KMEM_SIZE_SCALE
diff --git a/sys/sun4v/include/vmparam.h b/sys/sun4v/include/vmparam.h
index 1ee39bc..3b87bea 100644
--- a/sys/sun4v/include/vmparam.h
+++ b/sys/sun4v/include/vmparam.h
@@ -163,7 +163,8 @@
/*
* How many physical pages per KVA page allocated.
- * min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
+ * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE),
+ * VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX)
* is the total KVA space allocated for kmem_map.
*/
#ifndef VM_KMEM_SIZE_SCALE
OpenPOWER on IntegriCloud