Author: alc Date: Sun Aug 14 22:00:45 2016 New Revision: 304102 URL: https://svnweb.freebsd.org/changeset/base/304102
Log: Eliminate unneeded vm_page_xbusy() and vm_page_xunbusy() operations when neither vm_pager_has_page() nor vm_pager_get_pages() is called. Reviewed by: kib, markj MFC after: 3 weeks Modified: head/sys/kern/kern_exec.c head/sys/kern/uipc_shm.c head/sys/vm/vm_glue.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Sun Aug 14 20:22:03 2016 (r304101) +++ head/sys/kern/kern_exec.c Sun Aug 14 22:00:45 2016 (r304102) @@ -984,8 +984,9 @@ exec_map_first_page(imgp) #if VM_NRESERVLEVEL > 0 vm_object_color(object, 0); #endif - ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL); + ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); if (ma[0]->valid != VM_PAGE_BITS_ALL) { + vm_page_xbusy(ma[0]); if (!vm_pager_has_page(object, 0, NULL, &after)) { vm_page_lock(ma[0]); vm_page_free(ma[0]); @@ -1021,10 +1022,10 @@ exec_map_first_page(imgp) VM_OBJECT_WUNLOCK(object); return (EIO); } + vm_page_xunbusy(ma[0]); for (i = 1; i < initial_pagein; i++) vm_page_readahead_finish(ma[i]); } - vm_page_xunbusy(ma[0]); vm_page_lock(ma[0]); vm_page_hold(ma[0]); vm_page_activate(ma[0]); Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Sun Aug 14 20:22:03 2016 (r304101) +++ head/sys/kern/uipc_shm.c Sun Aug 14 22:00:45 2016 (r304102) @@ -182,8 +182,9 @@ uiomove_object_page(vm_object_t obj, siz * lock to page out tobj's pages because tobj is a OBJT_SWAP * type object. */ - m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL); + m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); if (m->valid != VM_PAGE_BITS_ALL) { + vm_page_xbusy(m); if (vm_pager_has_page(obj, idx, NULL, NULL)) { rv = vm_pager_get_pages(obj, &m, 1, NULL, NULL); if (rv != VM_PAGER_OK) { @@ -198,8 +199,8 @@ uiomove_object_page(vm_object_t obj, siz } } else vm_page_zero_invalid(m, TRUE); + vm_page_xunbusy(m); } - vm_page_xunbusy(m); vm_page_lock(m); vm_page_hold(m); if (m->queue == PQ_NONE) { Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sun Aug 14 20:22:03 2016 (r304101) +++ head/sys/vm/vm_glue.c Sun Aug 14 22:00:45 2016 (r304102) @@ -236,8 +236,9 @@ vm_imgact_hold_page(vm_object_t object, VM_OBJECT_WLOCK(object); pindex = OFF_TO_IDX(offset); - m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL); + m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY); if (m->valid != VM_PAGE_BITS_ALL) { + vm_page_xbusy(m); rv = vm_pager_get_pages(object, &m, 1, NULL, NULL); if (rv != VM_PAGER_OK) { vm_page_lock(m); @@ -246,8 +247,8 @@ vm_imgact_hold_page(vm_object_t object, m = NULL; goto out; } + vm_page_xunbusy(m); } - vm_page_xunbusy(m); vm_page_lock(m); vm_page_hold(m); vm_page_activate(m); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"