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
This commit is contained in:
parent
7a8d496378
commit
0e5179e441
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168920
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user