summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2008-06-09 20:30:26 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2008-06-09 20:30:26 +0000
commit2841d9faabe4c86665d799156297878ec3720e51 (patch)
tree3a96613ace1e9490f250100ba0b2002a60acc04b
parentd8f4e7941f8eb932a31090a45c6ce1d41b93e1ec (diff)
Define a new flag, UVM_FLAG_HOLE, for uvm_map to create a vm_map_entry of
a new etype, UVM_ET_HOLE, meaning it has no backend. UVM_ET_HOLE entries (which should be created as UVM_PROT_NONE and with UVM_FLAG_NOMERGE and UVM_FLAG_HOLE) are skipped in uvm_unmap_remove(), so that pmap_{k,}remove() is not called on the entry. This is intended to save time, and behave better, on pmaps with MMU holes at process exit time. ok art@, kettenis@ provided feedback as well.
-rw-r--r--share/man/man9/uvm.95
-rw-r--r--sys/uvm/uvm.h4
-rw-r--r--sys/uvm/uvm_extern.h3
-rw-r--r--sys/uvm/uvm_map.c8
-rw-r--r--usr.sbin/procmap/procmap.c11
5 files changed, 21 insertions, 10 deletions
diff --git a/share/man/man9/uvm.9 b/share/man/man9/uvm.9
index 3adb7515243..2381fc24b87 100644
--- a/share/man/man9/uvm.9
+++ b/share/man/man9/uvm.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: uvm.9,v 1.34 2008/05/06 16:26:07 jmc Exp $
+.\" $OpenBSD: uvm.9,v 1.35 2008/06/09 20:30:22 miod Exp $
.\" $NetBSD: uvm.9,v 1.14 2000/06/29 06:08:44 mrg Exp $
.\"
.\" Copyright (c) 1998 Matthew R. Green
@@ -30,7 +30,7 @@
.\" XXX this manual sets nS to 1 or 0 in the description, to obtain
.\" synopsis-like function prototypes. any better way?
.\"
-.Dd $Mdocdate: May 6 2008 $
+.Dd $Mdocdate: June 9 2008 $
.Dt UVM 9
.Os
.Sh NAME
@@ -257,6 +257,7 @@ can take are:
#define UVM_FLAG_COPYONW 0x080000 /* set copy_on_write flag */
#define UVM_FLAG_AMAPPAD 0x100000 /* bss: pad amap to reduce malloc() */
#define UVM_FLAG_TRYLOCK 0x200000 /* fail if we can not lock map */
+#define UVM_FLAG_HOLE 0x400000 /* no backend */
.Ed
.Pp
The
diff --git a/sys/uvm/uvm.h b/sys/uvm/uvm.h
index 977d45c3b29..3d04e53b9a4 100644
--- a/sys/uvm/uvm.h
+++ b/sys/uvm/uvm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm.h,v 1.23 2008/05/05 15:37:41 thib Exp $ */
+/* $OpenBSD: uvm.h,v 1.24 2008/06/09 20:30:23 miod Exp $ */
/* $NetBSD: uvm.h,v 1.24 2000/11/27 08:40:02 chs Exp $ */
/*
@@ -128,11 +128,13 @@ struct uvm {
#define UVM_ET_SUBMAP 0x02 /* it is a vm_map submap */
#define UVM_ET_COPYONWRITE 0x04 /* copy_on_write */
#define UVM_ET_NEEDSCOPY 0x08 /* needs_copy */
+#define UVM_ET_HOLE 0x10 /* no backend */
#define UVM_ET_ISOBJ(E) (((E)->etype & UVM_ET_OBJ) != 0)
#define UVM_ET_ISSUBMAP(E) (((E)->etype & UVM_ET_SUBMAP) != 0)
#define UVM_ET_ISCOPYONWRITE(E) (((E)->etype & UVM_ET_COPYONWRITE) != 0)
#define UVM_ET_ISNEEDSCOPY(E) (((E)->etype & UVM_ET_NEEDSCOPY) != 0)
+#define UVM_ET_ISHOLE(E) (((E)->etype & UVM_ET_HOLE) != 0)
#ifdef _KERNEL
diff --git a/sys/uvm/uvm_extern.h b/sys/uvm/uvm_extern.h
index 406a2a0391c..f0e48816b5b 100644
--- a/sys/uvm/uvm_extern.h
+++ b/sys/uvm/uvm_extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_extern.h,v 1.69 2008/04/09 16:58:11 deraadt Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.70 2008/06/09 20:30:23 miod Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/*
@@ -184,6 +184,7 @@ typedef int vm_prot_t;
#define UVM_FLAG_COPYONW 0x080000 /* set copy_on_write flag */
#define UVM_FLAG_AMAPPAD 0x100000 /* for bss: pad amap to reduce malloc() */
#define UVM_FLAG_TRYLOCK 0x200000 /* fail if we can not lock map */
+#define UVM_FLAG_HOLE 0x400000 /* no backend */
/* macros to extract info */
#define UVM_PROTECTION(X) ((X) & UVM_PROT_MASK)
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index bc605570b0d..a13a7ce92a6 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_map.c,v 1.99 2007/09/15 10:10:37 martin Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.100 2008/06/09 20:30:23 miod Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@@ -897,6 +897,8 @@ step3:
if ((flags & UVM_FLAG_OVERLAY) == 0)
new_entry->etype |= UVM_ET_NEEDSCOPY;
}
+ if (flags & UVM_FLAG_HOLE)
+ new_entry->etype |= UVM_ET_HOLE;
new_entry->protection = prot;
new_entry->max_protection = maxprot;
@@ -1451,7 +1453,9 @@ uvm_unmap_remove(struct vm_map *map, vaddr_t start, vaddr_t end,
* special case: handle mappings to anonymous kernel objects.
* we want to free these pages right away...
*/
- if (map->flags & VM_MAP_INTRSAFE) {
+ if (UVM_ET_ISHOLE(entry)) {
+ /* nothing to do! */
+ } else if (map->flags & VM_MAP_INTRSAFE) {
uvm_km_pgremove_intrsafe(entry->start, entry->end);
pmap_kremove(entry->start, len);
} else if (UVM_ET_ISOBJ(entry) &&
diff --git a/usr.sbin/procmap/procmap.c b/usr.sbin/procmap/procmap.c
index fc0cad510d6..2140d7423ba 100644
--- a/usr.sbin/procmap/procmap.c
+++ b/usr.sbin/procmap/procmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procmap.c,v 1.27 2007/10/02 14:50:49 kettenis Exp $ */
+/* $OpenBSD: procmap.c,v 1.28 2008/06/09 20:30:25 miod Exp $ */
/* $NetBSD: pmap.c,v 1.1 2002/09/01 20:32:44 atatat Exp $ */
/*
@@ -552,11 +552,12 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace,
printf(" end = %lx,", vme->end);
printf(" object.uvm_obj/sub_map = %p,\n", vme->object.uvm_obj);
printf(" offset = %lx,", (unsigned long)vme->offset);
- printf(" etype = %x <%s%s%s%s >,", vme->etype,
+ printf(" etype = %x <%s%s%s%s%s >,", vme->etype,
vme->etype & UVM_ET_OBJ ? " OBJ" : "",
vme->etype & UVM_ET_SUBMAP ? " SUBMAP" : "",
vme->etype & UVM_ET_COPYONWRITE ? " COW" : "",
- vme->etype & UVM_ET_NEEDSCOPY ? " NEEDSCOPY" : "");
+ vme->etype & UVM_ET_NEEDSCOPY ? " NEEDSCOPY" : "",
+ vme->etype & UVM_ET_HOLE ? " HOLE" : "");
printf(" protection = %x,\n", vme->protection);
printf(" max_protection = %x,", vme->max_protection);
printf(" inheritance = %d,", vme->inheritance);
@@ -811,7 +812,9 @@ findname(kvm_t *kd, struct kbit *vmspace,
D(vmspace, vmspace)->vm_dsize * getpagesize() / 2 <
(vme->end - vme->start)) {
name = " [ heap ]";
- } else
+ } else if (UVM_ET_ISHOLE(vme))
+ name = " [ hole ]";
+ else
name = " [ anon ]";
return (name);