svn commit: r322673 - stable/11/sys/vm
Mark Johnston
markj at FreeBSD.org
Fri Aug 18 20:20:51 UTC 2017
Author: markj
Date: Fri Aug 18 20:20:49 2017
New Revision: 322673
URL: https://svnweb.freebsd.org/changeset/base/322673
Log:
MFC r322391:
Micro-optimize kmem_unback().
Modified:
stable/11/sys/vm/vm_kern.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/vm/vm_kern.c
==============================================================================
--- stable/11/sys/vm/vm_kern.c Fri Aug 18 18:55:07 2017 (r322672)
+++ stable/11/sys/vm/vm_kern.c Fri Aug 18 20:20:49 2017 (r322673)
@@ -386,17 +386,19 @@ retry:
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);
}
More information about the svn-src-stable
mailing list