diff options
author | dillon <dillon@FreeBSD.org> | 2001-10-13 04:23:37 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2001-10-13 04:23:37 +0000 |
commit | d96ac0398e9f5a1127877c57b2b83cd02f91ac1f (patch) | |
tree | 133e1cfeee8758004498b409b7afbdb7c3c78b07 /sys/vm | |
parent | 07ef386ebd0acb1d39725f6118f77ce6f6d487eb (diff) | |
download | FreeBSD-src-d96ac0398e9f5a1127877c57b2b83cd02f91ac1f.zip FreeBSD-src-d96ac0398e9f5a1127877c57b2b83cd02f91ac1f.tar.gz |
Makes contigalloc[1]() create the vm_map / underlying wired pages in the
kernel map and object in a manner that contigfree() is actually able to
free. Previously contigfree() freed up the KVA space but could not
unwire & free the underlying VM pages due to mismatched pageability between
the map entry and the VM pages.
Submitted by: Thomas Moestl <tmoestl@gmx.net>
Testing by: mark tinguely <tinguely@web.cs.ndsu.nodak.edu>
MFC after: 3 days
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_contig.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/vm/vm_contig.c b/sys/vm/vm_contig.c index b515e85..46216a2 100644 --- a/sys/vm/vm_contig.c +++ b/sys/vm/vm_contig.c @@ -76,6 +76,8 @@ #include <vm/vm.h> #include <vm/vm_param.h> #include <vm/vm_kern.h> +#include <vm/pmap.h> +#include <vm/vm_map.h> #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_pageout.h> @@ -232,7 +234,6 @@ again1: m->busy = 0; m->queue = PQ_NONE; m->object = NULL; - vm_page_wire(m); } /* @@ -240,24 +241,31 @@ again1: * Allocate kernel VM, unfree and assign the physical pages to it and * return kernel VM pointer. */ - tmp_addr = addr = kmem_alloc_pageable(map, size); - if (addr == 0) { + vm_map_lock(map); + if (vm_map_findspace(map, vm_map_min(map), size, &addr) != + KERN_SUCCESS) { /* * XXX We almost never run out of kernel virtual * space, so we don't make the allocated memory * above available. */ + vm_map_unlock(map); splx(s); return (NULL); } + vm_object_reference(kernel_object); + vm_map_insert(map, kernel_object, addr - VM_MIN_KERNEL_ADDRESS, + addr, addr + size, VM_PROT_ALL, VM_PROT_ALL, 0); + vm_map_unlock(map); + tmp_addr = addr; for (i = start; i < (start + size / PAGE_SIZE); i++) { vm_page_t m = &pga[i]; vm_page_insert(m, kernel_object, OFF_TO_IDX(tmp_addr - VM_MIN_KERNEL_ADDRESS)); - pmap_kenter(tmp_addr, VM_PAGE_TO_PHYS(m)); tmp_addr += PAGE_SIZE; } + vm_map_pageable(map, addr, addr + size, FALSE); splx(s); return ((void *)addr); |