From a50b7054038f590272a51cda3bd1945331df7882 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 25 Oct 2004 06:34:14 +0000 Subject: [PATCH] Use VM_ALLOC_NOBUSY to eliminate vm_page_wakeup() calls and the acquisition and release of the global page queues lock required to make the call. Remove GIANT_REQUIRED from vm_hold_free_pages(). All of its VM operations are properly synchronized. --- sys/kern/vfs_bio.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index cf932b48eeab..453ea5c53f4e 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2882,7 +2882,8 @@ allocbuf(struct buf *bp, int size) * process we are. */ m = vm_page_alloc(obj, pi, - VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); + VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM | + VM_ALLOC_WIRED); if (m == NULL) { atomic_add_int(&vm_pageout_deficit, desiredpages - bp->b_npages); @@ -2890,9 +2891,6 @@ allocbuf(struct buf *bp, int size) VM_WAIT; VM_OBJECT_LOCK(obj); } else { - vm_page_lock_queues(); - vm_page_wakeup(m); - vm_page_unlock_queues(); bp->b_flags &= ~B_CACHE; bp->b_pages[bp->b_npages] = m; ++bp->b_npages; @@ -3623,7 +3621,7 @@ tryagain: */ p = vm_page_alloc(kernel_object, ((pg - VM_MIN_KERNEL_ADDRESS) >> PAGE_SHIFT), - VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); + VM_ALLOC_NOBUSY | VM_ALLOC_SYSTEM | VM_ALLOC_WIRED); if (!p) { atomic_add_int(&vm_pageout_deficit, (to - pg) >> PAGE_SHIFT); @@ -3635,9 +3633,6 @@ tryagain: p->valid = VM_PAGE_BITS_ALL; pmap_qenter(pg, &p, 1); bp->b_pages[index] = p; - vm_page_lock_queues(); - vm_page_wakeup(p); - vm_page_unlock_queues(); } VM_OBJECT_UNLOCK(kernel_object); bp->b_npages = index; @@ -3651,8 +3646,6 @@ vm_hold_free_pages(struct buf *bp, vm_offset_t from, vm_offset_t to) vm_page_t p; int index, newnpages; - GIANT_REQUIRED; - from = round_page(from); to = round_page(to); newnpages = index = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT;