Micro-optimize kmem_unback().
We can remove some unnecessary object radix tree lookups by using the object memq to iterate over pages in the specified range. This does not, however, eliminate the lookup needed in vm_page_free_toq() to remove each tree entry. Reviewed by: alc, kib (previous revision) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11945
This commit is contained in:
parent
ee51cfe17c
commit
7e05ffa6e6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=322391
@ -386,17 +386,19 @@ kmem_back(vm_object_t object, vm_offset_t addr, vm_size_t size, int flags)
|
||||
void
|
||||
kmem_unback(vm_object_t object, vm_offset_t addr, vm_size_t size)
|
||||
{
|
||||
vm_page_t m;
|
||||
vm_offset_t i, offset;
|
||||
vm_page_t m, next;
|
||||
vm_offset_t end, offset;
|
||||
|
||||
KASSERT(object == kmem_object || object == kernel_object,
|
||||
("kmem_unback: only supports kernel objects."));
|
||||
|
||||
pmap_remove(kernel_pmap, addr, addr + size);
|
||||
offset = addr - VM_MIN_KERNEL_ADDRESS;
|
||||
end = offset + size;
|
||||
VM_OBJECT_WLOCK(object);
|
||||
for (i = 0; i < size; i += PAGE_SIZE) {
|
||||
m = vm_page_lookup(object, atop(offset + i));
|
||||
for (m = vm_page_lookup(object, atop(offset)); offset < end;
|
||||
offset += PAGE_SIZE, m = next) {
|
||||
next = vm_page_next(m);
|
||||
vm_page_unwire(m, PQ_NONE);
|
||||
vm_page_free(m);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user