Date: Fri, 29 May 2009 18:35:51 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r193044 - head/sys/kern Message-ID: <200905291835.n4TIZpIQ082882@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Fri May 29 18:35:51 2009 New Revision: 193044 URL: http://svn.freebsd.org/changeset/base/193044 Log: 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(). Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Fri May 29 16:24:23 2009 (r193043) +++ head/sys/kern/vfs_bio.c Fri May 29 18:35:51 2009 (r193044) @@ -3796,30 +3796,25 @@ vm_hold_load_pages(struct buf *bp, vm_of 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_of 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_of } 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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905291835.n4TIZpIQ082882>