Try to dynamically size the VM_KMEM_SIZE (but is still able to be overridden
in a way identically as before.) I had problems with the system properly handling the number of vnodes when there is alot of system memory, and the default VM_KMEM_SIZE. Two new options "VM_KMEM_SIZE_SCALE" and "VM_KMEM_SIZE_MAX" have been added to support better auto-sizing for systems with greater than 128MB. Add some accouting for vm_zone memory allocations, and provide properly for vm_zone allocations out of the kmem_map. Also move the vm_zone allocation stats to the VM OID tree from the KERN OID tree.
This commit is contained in:
parent
8a58a9f6c9
commit
d9bed5bee1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=33757
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91
|
||||
* $Id: vmparam.h,v 1.27 1997/10/27 00:38:46 jkh Exp $
|
||||
* $Id: vmparam.h,v 1.28 1998/02/05 03:31:53 dyson Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -117,7 +117,23 @@
|
||||
|
||||
/* virtual sizes (bytes) for various kernel submaps */
|
||||
#ifndef VM_KMEM_SIZE
|
||||
#define VM_KMEM_SIZE (32 * 1024 * 1024)
|
||||
#define VM_KMEM_SIZE (12 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* How many physical pages per KVA page allocated.
|
||||
* min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
|
||||
* is the total KVA space allocated for kmem_map.
|
||||
*/
|
||||
#ifndef VM_KMEM_SIZE_SCALE
|
||||
#define VM_KMEM_SIZE_SCALE (3)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ceiling on amount of kmem_map kva space.
|
||||
*/
|
||||
#ifndef VM_KMEM_SIZE_MAX
|
||||
#define VM_KMEM_SIZE_MAX (80 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
/* initial pagein size of beginning of executable file */
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: options,v 1.60 1998/02/12 18:02:04 eivind Exp $
|
||||
# $Id: options,v 1.61 1998/02/16 23:57:33 eivind Exp $
|
||||
|
||||
# Format:
|
||||
# Option name filename
|
||||
@ -175,3 +175,8 @@ SI_DEBUG opt_debug_si.h
|
||||
DEBUG opt_global.h
|
||||
DIAGNOSTIC opt_global.h
|
||||
SIMPLELOCK_DEBUG opt_global.h
|
||||
|
||||
# These are VM related options
|
||||
VM_KMEM_SIZE opt_vm.h
|
||||
VM_KMEM_SIZE_SCALE opt_vm.h
|
||||
VM_KMEM_SIZE_MAX opt_vm.h
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91
|
||||
* $Id: vmparam.h,v 1.27 1997/10/27 00:38:46 jkh Exp $
|
||||
* $Id: vmparam.h,v 1.28 1998/02/05 03:31:53 dyson Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -117,7 +117,23 @@
|
||||
|
||||
/* virtual sizes (bytes) for various kernel submaps */
|
||||
#ifndef VM_KMEM_SIZE
|
||||
#define VM_KMEM_SIZE (32 * 1024 * 1024)
|
||||
#define VM_KMEM_SIZE (12 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* How many physical pages per KVA page allocated.
|
||||
* min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
|
||||
* is the total KVA space allocated for kmem_map.
|
||||
*/
|
||||
#ifndef VM_KMEM_SIZE_SCALE
|
||||
#define VM_KMEM_SIZE_SCALE (3)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Ceiling on amount of kmem_map kva space.
|
||||
*/
|
||||
#ifndef VM_KMEM_SIZE_MAX
|
||||
#define VM_KMEM_SIZE_MAX (80 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
/* initial pagein size of beginning of executable file */
|
||||
|
@ -11,7 +11,7 @@
|
||||
* 2. Absolutely no warranty of function or purpose is made by the author
|
||||
* John S. Dyson.
|
||||
*
|
||||
* $Id: vm_zone.c,v 1.17 1998/02/06 12:14:29 eivind Exp $
|
||||
* $Id: vm_zone.c,v 1.18 1998/02/09 06:11:36 eivind Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -51,6 +51,7 @@ static MALLOC_DEFINE(M_ZONE, "ZONE", "Zone header");
|
||||
|
||||
static struct vm_zone *zlist;
|
||||
static int sysctl_vm_zone SYSCTL_HANDLER_ARGS;
|
||||
static int zone_kmem_pages, zone_kern_pages, zone_kmem_kvaspace;
|
||||
|
||||
/*
|
||||
* Create a zone, but don't allocate the zone structure. If the
|
||||
@ -108,6 +109,7 @@ zinitna(vm_zone_t z, vm_object_t obj, char *name, int size,
|
||||
if (z->zflags & ZONE_INTERRUPT) {
|
||||
|
||||
totsize = round_page(z->zsize * nentries);
|
||||
zone_kmem_kvaspace += totsize;
|
||||
|
||||
z->zkva = kmem_alloc_pageable(kernel_map, totsize);
|
||||
if (z->zkva == 0)
|
||||
@ -302,6 +304,7 @@ _zget(vm_zone_t z)
|
||||
pmap_kenter(zkva, VM_PAGE_TO_PHYS(m));
|
||||
bzero((caddr_t) zkva, PAGE_SIZE);
|
||||
z->zpagecount++;
|
||||
zone_kmem_pages++;
|
||||
}
|
||||
nitems = (i * PAGE_SIZE) / z->zsize;
|
||||
} else {
|
||||
@ -324,9 +327,11 @@ _zget(vm_zone_t z)
|
||||
int s;
|
||||
s = splvm();
|
||||
item = (void *) kmem_malloc(kmem_map, nbytes, M_WAITOK);
|
||||
zone_kmem_pages += z->zalloc;
|
||||
splx(s);
|
||||
} else {
|
||||
item = (void *) kmem_alloc(kernel_map, nbytes);
|
||||
zone_kern_pages += z->zalloc;
|
||||
}
|
||||
bzero(item, nbytes);
|
||||
nitems = nbytes / z->zsize;
|
||||
@ -438,5 +443,12 @@ zerror(int error)
|
||||
}
|
||||
#endif
|
||||
|
||||
SYSCTL_OID(_kern, OID_AUTO, zone, CTLTYPE_STRING|CTLFLAG_RD, \
|
||||
SYSCTL_OID(_vm, OID_AUTO, zone, CTLTYPE_STRING|CTLFLAG_RD, \
|
||||
NULL, 0, sysctl_vm_zone, "A", "Zone Info");
|
||||
|
||||
SYSCTL_INT(_vm, OID_AUTO, zone_kmem_pages,
|
||||
CTLFLAG_RD, &zone_kmem_pages, 0, "");
|
||||
SYSCTL_INT(_vm, OID_AUTO, zone_kmem_kvaspace,
|
||||
CTLFLAG_RD, &zone_kmem_kvaspace, 0, "");
|
||||
SYSCTL_INT(_vm, OID_AUTO, zone_kern_pages,
|
||||
CTLFLAG_RD, &zone_kern_pages, 0, "");
|
||||
|
Loading…
Reference in New Issue
Block a user