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.
This commit is contained in:
Alan Cox 2004-10-25 06:34:14 +00:00
parent 4dcd0ac4cf
commit a50b705403

View File

@ -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 @@ vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to)
*/
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 @@ vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to)
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;