diff options
author | peter <peter@FreeBSD.org> | 2004-07-21 00:29:21 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2004-07-21 00:29:21 +0000 |
commit | 01e5736d40b77bfeecb880d20f407f3b46e6876f (patch) | |
tree | ae883af25e2efb9aae43652f1967ca375d910008 | |
parent | 4f3de515b5d2c4992f8d1b55f58f34631f9ff6f0 (diff) | |
download | FreeBSD-src-01e5736d40b77bfeecb880d20f407f3b46e6876f.zip FreeBSD-src-01e5736d40b77bfeecb880d20f407f3b46e6876f.tar.gz |
Move the initialization and teardown of pmaps to the vmspace zone's
init and fini handlers. Our vm system removes all userland mappings at
exit prior to calling pmap_release. It just so happens that we might
as well reuse the pmap for the next process since the userland slate
has already been wiped clean.
However. There is a functional benefit to this as well. For platforms
that share userland and kernel context in the same pmap, it means that
the kernel portion of a pmap remains valid after the vmspace has been
freed (process exit) and while it is in uma's cache. This is significant
for i386 SMP systems with kernel context borrowing because it avoids
a LOT of IPIs from the pmap_lazyfix() cleanup in the usual case.
Tested on: amd64, i386, sparc64, alpha
Glanced at by: alc
-rw-r--r-- | sys/vm/vm_map.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index ba07796..e5209b5 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -175,7 +175,7 @@ vmspace_zfini(void *mem, int size) struct vmspace *vm; vm = (struct vmspace *)mem; - + pmap_release(vmspace_pmap(vm)); vm_map_zfini(&vm->vm_map, sizeof(vm->vm_map)); } @@ -187,6 +187,7 @@ vmspace_zinit(void *mem, int size) vm = (struct vmspace *)mem; vm_map_zinit(&vm->vm_map, sizeof(vm->vm_map)); + pmap_pinit(vmspace_pmap(vm)); } static void @@ -254,7 +255,6 @@ vmspace_alloc(min, max) vm = uma_zalloc(vmspace_zone, M_WAITOK); CTR1(KTR_VM, "vmspace_alloc: %p", vm); _vm_map_init(&vm->vm_map, min, max); - pmap_pinit(vmspace_pmap(vm)); vm->vm_map.pmap = vmspace_pmap(vm); /* XXX */ vm->vm_refcnt = 1; vm->vm_shm = NULL; @@ -299,7 +299,6 @@ vmspace_dofree(struct vmspace *vm) vm->vm_map.max_offset); vm_map_unlock(&vm->vm_map); - pmap_release(vmspace_pmap(vm)); uma_zfree(vmspace_zone, vm); } |