From b77de226503076b55efebae9b92333cd8c2535d9 Mon Sep 17 00:00:00 2001 From: dyson Date: Mon, 23 Feb 1998 07:42:43 +0000 Subject: 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. --- sys/vm/vm_zone.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sys/vm') diff --git a/sys/vm/vm_zone.c b/sys/vm/vm_zone.c index 7f4c5d0..c06c3e4 100644 --- a/sys/vm/vm_zone.c +++ b/sys/vm/vm_zone.c @@ -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 @@ -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, ""); -- cgit v1.1