diff options
-rw-r--r-- | sys/uvm/uvm_extern.h | 3 | ||||
-rw-r--r-- | sys/uvm/uvm_map.c | 34 | ||||
-rw-r--r-- | usr.bin/systat/vmstat.c | 10 |
3 files changed, 34 insertions, 13 deletions
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h index a65dff88d1f..f9f52056fee 100644 --- a/sys/uvm/uvm_extern.h +++ b/sys/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.57 2005/09/12 23:05:06 miod Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.58 2005/09/28 00:24:03 pedro Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -360,6 +360,7 @@ struct uvmexp { struct uvm_object *kmem_object; int fpswtch; /* FPU context switches */ + int kmapent; /* number of kernel map entries */ }; #ifdef _KERNEL diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c index e0424a2cc32..e8db18b361d 100644 --- a/sys/uvm/uvm_map.c +++ b/sys/uvm/uvm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.72 2005/06/29 06:07:32 deraadt Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.73 2005/09/28 00:24:03 pedro Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -94,6 +94,9 @@ #include <uvm/uvm_ddb.h> #endif +static struct timeval uvm_kmapent_last_warn_time; +static struct timeval uvm_kmapent_warn_rate = { 10, 0 }; + struct uvm_cnt uvm_map_call, map_backmerge, map_forwmerge; struct uvm_cnt uvm_mlk_call, uvm_mlk_hint; const char vmmapbsy[] = "vmmapbsy"; @@ -378,22 +381,34 @@ _uvm_tree_sanity(vm_map_t map, const char *name) struct vm_map_entry * uvm_mapent_alloc(struct vm_map *map) { - struct vm_map_entry *me; - int s; + struct vm_map_entry *me, *ne; + int s, i; UVMHIST_FUNC("uvm_mapent_alloc"); UVMHIST_CALLED(maphist); if (map->flags & VM_MAP_INTRSAFE || cold) { s = splvm(); simple_lock(&uvm.kentry_lock); me = uvm.kentry_free; - if (me) uvm.kentry_free = me->next; - simple_unlock(&uvm.kentry_lock); - splx(s); if (me == NULL) { - panic("uvm_mapent_alloc: out of static map entries, " - "check MAX_KMAPENT (currently %d)", - MAX_KMAPENT); + ne = uvm_km_getpage(0); + if (ne == NULL) + panic("uvm_mapent_alloc: cannot allocate map " + "entry"); + for (i = 0; + i < PAGE_SIZE / sizeof(struct vm_map_entry) - 1; + i++) + ne[i].next = &ne[i + 1]; + ne[i].next = NULL; + me = ne; + if (ratecheck(&uvm_kmapent_last_warn_time, + &uvm_kmapent_warn_rate)) + printf("uvm_mapent_alloc: out of static " + "map entries\n"); } + uvm.kentry_free = me->next; + uvmexp.kmapent++; + simple_unlock(&uvm.kentry_lock); + splx(s); me->flags = UVM_MAP_STATIC; } else if (map == kernel_map) { splassert(IPL_NONE); @@ -429,6 +444,7 @@ uvm_mapent_free(struct vm_map_entry *me) simple_lock(&uvm.kentry_lock); me->next = uvm.kentry_free; uvm.kentry_free = me; + uvmexp.kmapent--; simple_unlock(&uvm.kentry_lock); splx(s); } else if (me->flags & UVM_MAP_KMEM) { diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index 79408603d93..36886fcc6ae 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmstat.c,v 1.54 2005/04/04 08:54:33 deraadt Exp $ */ +/* $OpenBSD: vmstat.c,v 1.55 2005/09/28 00:24:04 pedro Exp $ */ /* $NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $ */ /*- @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; #endif -static char rcsid[] = "$OpenBSD: vmstat.c,v 1.54 2005/04/04 08:54:33 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: vmstat.c,v 1.55 2005/09/28 00:24:04 pedro Exp $"; #endif /* not lint */ /* @@ -144,7 +144,7 @@ closekre(WINDOW *w) #define PROCSCOL 0 #define GENSTATROW 7 /* uses 2 rows and 35 cols */ #define GENSTATCOL 16 -#define VMSTATROW 7 /* uses 17 rows and 12 cols */ +#define VMSTATROW 7 /* uses 18 rows and 12 cols */ #define VMSTATCOL 48 #define GRAPHROW 10 /* uses 3 rows and 51 cols */ #define GRAPHCOL 0 @@ -260,6 +260,8 @@ labelkre(void) mvprintw(VMSTATROW + 16, VMSTATCOL + 10, "pdscn"); if (LINES - 1 > VMSTATROW + 17) mvprintw(VMSTATROW + 17, VMSTATCOL + 10, "pzidle"); + if (LINES - 1 > VMSTATROW + 18) + mvprintw(VMSTATROW + 18, VMSTATCOL + 10, "kmapent"); mvprintw(GENSTATROW, GENSTATCOL, " Csw Trp Sys Int Sof Flt"); @@ -441,6 +443,8 @@ showkre(void) PUTRATE(uvmexp.pdscans, VMSTATROW + 16, VMSTATCOL, 9); if (LINES - 1 > VMSTATROW + 17) PUTRATE(uvmexp.zeropages, VMSTATROW + 17, VMSTATCOL, 9); + if (LINES - 1 > VMSTATROW + 18) + putint(s.uvmexp.kmapent, VMSTATROW + 18, VMSTATCOL, 9); PUTRATE(uvmexp.pageins, PAGEROW + 2, PAGECOL + 5, 5); PUTRATE(uvmexp.pdpageouts, PAGEROW + 2, PAGECOL + 10, 5); |