summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2009-05-29 18:35:51 +0000
committeralc <alc@FreeBSD.org>2009-05-29 18:35:51 +0000
commit40062c9280416ae05d892e9651e3889e64644621 (patch)
treef4d2cd4952f9df67da0c57aed49471387ad4d1e1 /sys/kern
parentb6666822bf294f95488fd0cea33197358ed95ef5 (diff)
downloadFreeBSD-src-40062c9280416ae05d892e9651e3889e64644621.zip
FreeBSD-src-40062c9280416ae05d892e9651e3889e64644621.tar.gz
Modify vm_hold_load_pages() to allocate pages using VM_ALLOC_NOOBJ rather
than using the kernel object. This allows the elimination of page queues locking from vm_hold_free_pages().
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_bio.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 0817c7f..e6e7fe2 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -3796,30 +3796,25 @@ vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to)
from = round_page(from);
index = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT;
- VM_OBJECT_LOCK(kernel_object);
for (pg = from; pg < to; pg += PAGE_SIZE, index++) {
tryagain:
/*
* note: must allocate system pages since blocking here
- * could intefere with paging I/O, no matter which
+ * could interfere with paging I/O, no matter which
* process we are.
*/
- p = vm_page_alloc(kernel_object,
- ((pg - VM_MIN_KERNEL_ADDRESS) >> PAGE_SHIFT),
- VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED);
+ p = vm_page_alloc(NULL, pg >> PAGE_SHIFT, VM_ALLOC_NOOBJ |
+ VM_ALLOC_SYSTEM | VM_ALLOC_WIRED);
if (!p) {
atomic_add_int(&vm_pageout_deficit,
(to - pg) >> PAGE_SHIFT);
- VM_OBJECT_UNLOCK(kernel_object);
VM_WAIT;
- VM_OBJECT_LOCK(kernel_object);
goto tryagain;
}
p->valid = VM_PAGE_BITS_ALL;
pmap_qenter(pg, &p, 1);
bp->b_pages[index] = p;
}
- VM_OBJECT_UNLOCK(kernel_object);
bp->b_npages = index;
}
@@ -3835,7 +3830,6 @@ vm_hold_free_pages(struct buf *bp, vm_offset_t from, vm_offset_t to)
to = round_page(to);
newnpages = index = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT;
- VM_OBJECT_LOCK(kernel_object);
for (pg = from; pg < to; pg += PAGE_SIZE, index++) {
p = bp->b_pages[index];
if (p && (index < bp->b_npages)) {
@@ -3847,13 +3841,11 @@ vm_hold_free_pages(struct buf *bp, vm_offset_t from, vm_offset_t to)
}
bp->b_pages[index] = NULL;
pmap_qremove(pg, 1);
- vm_page_lock_queues();
- vm_page_unwire(p, 0);
+ p->wire_count--;
vm_page_free(p);
- vm_page_unlock_queues();
+ atomic_subtract_int(&cnt.v_wire_count, 1);
}
}
- VM_OBJECT_UNLOCK(kernel_object);
bp->b_npages = newnpages;
}
OpenPOWER on IntegriCloud