From owner-p4-projects@FreeBSD.ORG Sun May 2 19:39:02 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6AC691065673; Sun, 2 May 2010 19:39:02 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2EF9B106564A for ; Sun, 2 May 2010 19:39:02 +0000 (UTC) (envelope-from mav@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 1BDF98FC15 for ; Sun, 2 May 2010 19:39:02 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o42Jd27u063423 for ; Sun, 2 May 2010 19:39:02 GMT (envelope-from mav@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o42Jd1GD063421 for perforce@freebsd.org; Sun, 2 May 2010 19:39:01 GMT (envelope-from mav@freebsd.org) Date: Sun, 2 May 2010 19:39:01 GMT Message-Id: <201005021939.o42Jd1GD063421@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to mav@freebsd.org using -f From: Alexander Motin To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 177615 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 May 2010 19:39:02 -0000 http://p4web.freebsd.org/@@177615?ac=10 Change 177615 by mav@mav_mavbook on 2010/05/02 19:38:39 IFC Affected files ... .. //depot/projects/scottl-camlock/src/sbin/camcontrol/camcontrol.8#13 integrate .. //depot/projects/scottl-camlock/src/sbin/camcontrol/camcontrol.c#41 integrate .. //depot/projects/scottl-camlock/src/share/man/man4/Makefile#26 integrate .. //depot/projects/scottl-camlock/src/sys/arm/mv/files.mv#4 integrate .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#36 integrate .. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#89 integrate .. //depot/projects/scottl-camlock/src/sys/cam/cam_ccb.h#42 integrate .. //depot/projects/scottl-camlock/src/sys/conf/NOTES#58 integrate .. //depot/projects/scottl-camlock/src/sys/conf/files#75 integrate .. //depot/projects/scottl-camlock/src/sys/conf/kmod.mk#24 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#112 integrate .. //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.h#40 integrate .. //depot/projects/scottl-camlock/src/sys/dev/quicc/quicc_bfe.h#2 integrate .. //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#48 integrate .. //depot/projects/scottl-camlock/src/sys/dev/siis/siis.h#18 integrate .. //depot/projects/scottl-camlock/src/sys/dev/uart/uart_dev_ns8250.c#13 integrate .. //depot/projects/scottl-camlock/src/sys/fs/tmpfs/tmpfs_vnops.c#10 integrate .. //depot/projects/scottl-camlock/src/sys/kern/uipc_syscalls.c#36 integrate .. //depot/projects/scottl-camlock/src/sys/kern/vfs_bio.c#25 integrate .. //depot/projects/scottl-camlock/src/sys/mips/cavium/uart_dev_oct16550.c#2 integrate .. //depot/projects/scottl-camlock/src/sys/modules/Makefile#51 integrate .. //depot/projects/scottl-camlock/src/sys/sparc64/sparc64/interrupt.S#6 integrate .. //depot/projects/scottl-camlock/src/sys/vm/vm_contig.c#23 integrate .. //depot/projects/scottl-camlock/src/sys/vm/vm_fault.c#34 integrate .. //depot/projects/scottl-camlock/src/sys/vm/vm_object.c#25 integrate .. //depot/projects/scottl-camlock/src/sys/vm/vm_page.c#28 integrate Differences ... ==== //depot/projects/scottl-camlock/src/sbin/camcontrol/camcontrol.8#13 (text+ko) ==== @@ -25,9 +25,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/sbin/camcontrol/camcontrol.8,v 1.49 2010/01/20 13:31:12 mav Exp $ +.\" $FreeBSD: src/sbin/camcontrol/camcontrol.8,v 1.50 2010/05/02 11:36:27 mav Exp $ .\" -.Dd January 20, 2010 +.Dd May 2, 2010 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -123,6 +123,8 @@ .Op generic args .Aq Fl a Ar cmd Op args .Aq Fl c Ar cmd Op args +.Op Fl d +.Op Fl f .Op Fl i Ar len Ar fmt .Bk -words .Op Fl o Ar len Ar fmt Op args @@ -530,6 +532,10 @@ .It Fl c Ar cmd Op args This specifies the SCSI CDB. SCSI CDBs may be 6, 10, 12 or 16 bytes. +.It Fl d +Specifies DMA protocol to be used for ATA command. +.It Fl f +Specifies FPDMA (NCQ) protocol to be used for ATA command. .It Fl i Ar len Ar fmt This specifies the amount of data to read, and how it should be displayed. If the format is ==== //depot/projects/scottl-camlock/src/sbin/camcontrol/camcontrol.c#41 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sbin/camcontrol/camcontrol.c,v 1.74 2010/02/22 10:45:40 mav Exp $"); +__FBSDID("$FreeBSD: src/sbin/camcontrol/camcontrol.c,v 1.76 2010/05/02 12:07:47 mav Exp $"); #include #include @@ -4369,7 +4369,7 @@ " [-P pagectl][-e | -b][-d]\n" " camcontrol cmd [dev_id][generic args]\n" " <-a cmd [args] | -c cmd [args]>\n" -" [-i len fmt|-o len fmt [args]] [-r fmt]\n" +" [-d] [-f] [-i len fmt|-o len fmt [args]] [-r fmt]\n" " camcontrol debug [-I][-P][-T][-S][-X][-c]\n" " \n" " camcontrol tags [dev_id][generic args] [-N tags] [-q] [-v]\n" ==== //depot/projects/scottl-camlock/src/share/man/man4/Makefile#26 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 6/18/93 -# $FreeBSD: src/share/man/man4/Makefile,v 1.477 2010/04/14 21:27:48 yongari Exp $ +# $FreeBSD: src/share/man/man4/Makefile,v 1.478 2010/05/02 19:28:30 mav Exp $ MAN= aac.4 \ acpi.4 \ ==== //depot/projects/scottl-camlock/src/sys/arm/mv/files.mv#4 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/arm/mv/files.mv,v 1.6 2009/06/24 15:41:18 raj Exp $ +# $FreeBSD: src/sys/arm/mv/files.mv,v 1.7 2010/05/02 19:28:30 mav Exp $ # # The Marvell CPU cores # - Compliant with V5TE architecture ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#36 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/ata/ata_pmp.c,v 1.7 2010/02/02 18:03:21 mav Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/ata/ata_pmp.c,v 1.8 2010/05/02 12:07:47 mav Exp $"); #include ==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#89 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/ata/ata_xpt.c,v 1.29 2010/04/30 07:56:21 mav Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/ata/ata_xpt.c,v 1.30 2010/05/02 12:07:47 mav Exp $"); #include #include ==== //depot/projects/scottl-camlock/src/sys/cam/cam_ccb.h#42 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/cam/cam_ccb.h,v 1.44 2010/02/02 11:09:28 mav Exp $ + * $FreeBSD: src/sys/cam/cam_ccb.h,v 1.45 2010/05/02 12:07:47 mav Exp $ */ #ifndef _CAM_CAM_CCB_H ==== //depot/projects/scottl-camlock/src/sys/conf/NOTES#58 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1582 2010/05/01 16:36:14 imp Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1583 2010/05/02 19:28:30 mav Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # ==== //depot/projects/scottl-camlock/src/sys/conf/files#75 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1514 2010/04/28 22:25:27 jkim Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1515 2010/05/02 19:28:30 mav Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and ==== //depot/projects/scottl-camlock/src/sys/conf/kmod.mk#24 (text+ko) ==== @@ -1,5 +1,5 @@ # From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $FreeBSD: src/sys/conf/kmod.mk,v 1.232 2010/04/22 09:24:01 netchild Exp $ +# $FreeBSD: src/sys/conf/kmod.mk,v 1.233 2010/05/02 19:28:30 mav Exp $ # # The include file handles building and installing loadable # kernel modules. ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.c#112 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ahci/ahci.c,v 1.33 2010/04/30 08:02:12 mav Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ahci/ahci.c,v 1.35 2010/05/02 14:46:05 mav Exp $"); #include #include @@ -340,6 +340,7 @@ rman_fini(&ctlr->sc_iomem); return (error); } + pci_enable_busmaster(dev); /* Reset controller */ if ((error = ahci_ctlr_reset(dev)) != 0) { bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); ==== //depot/projects/scottl-camlock/src/sys/dev/ahci/ahci.h#40 (text+ko) ==== @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ahci/ahci.h,v 1.11 2010/02/14 12:30:35 mav Exp $ + * $FreeBSD: src/sys/dev/ahci/ahci.h,v 1.12 2010/05/02 12:07:47 mav Exp $ */ /* ATA register defines */ ==== //depot/projects/scottl-camlock/src/sys/dev/quicc/quicc_bfe.h#2 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/quicc/quicc_bfe.h,v 1.1 2008/03/03 18:20:16 raj Exp $ + * $FreeBSD: src/sys/dev/quicc/quicc_bfe.h,v 1.2 2010/05/02 19:05:57 marius Exp $ */ #ifndef _DEV_QUICC_BFE_H_ @@ -50,7 +50,6 @@ u_int sc_clock; int sc_fastintr:1; - int sc_leaving:1; int sc_polled:1; }; ==== //depot/projects/scottl-camlock/src/sys/dev/siis/siis.c#48 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/siis/siis.c,v 1.25 2010/04/30 08:22:47 mav Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/siis/siis.c,v 1.26 2010/05/02 12:07:47 mav Exp $"); #include #include ==== //depot/projects/scottl-camlock/src/sys/dev/siis/siis.h#18 (text+ko) ==== @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/siis/siis.h,v 1.9 2010/02/02 11:09:28 mav Exp $ + * $FreeBSD: src/sys/dev/siis/siis.h,v 1.10 2010/05/02 12:07:47 mav Exp $ */ /* ATA register defines */ ==== //depot/projects/scottl-camlock/src/sys/dev/uart/uart_dev_ns8250.c#13 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/uart/uart_dev_ns8250.c,v 1.30 2009/04/08 00:14:06 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/uart/uart_dev_ns8250.c,v 1.31 2010/05/02 19:07:19 marius Exp $"); #include #include @@ -604,7 +604,7 @@ if (ipend == 0) ns8250_clrint(bas); uart_unlock(sc->sc_hwmtx); - return ((sc->sc_leaving) ? 0 : ipend); + return (ipend); } static int ==== //depot/projects/scottl-camlock/src/sys/fs/tmpfs/tmpfs_vnops.c#10 (text+ko) ==== @@ -34,7 +34,7 @@ * tmpfs vnode interface. */ #include -__FBSDID("$FreeBSD: src/sys/fs/tmpfs/tmpfs_vnops.c,v 1.34 2009/10/11 07:03:56 delphij Exp $"); +__FBSDID("$FreeBSD: src/sys/fs/tmpfs/tmpfs_vnops.c,v 1.35 2010/05/02 17:33:46 alc Exp $"); #include #include @@ -516,8 +516,16 @@ lookupvpg: if (((m = vm_page_lookup(vobj, idx)) != NULL) && vm_page_is_valid(m, offset, tlen)) { - if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) + if ((m->oflags & VPO_BUSY) != 0) { + /* + * Reference the page before unlocking and sleeping so + * that the page daemon is less likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(m, PG_REFERENCED); + vm_page_sleep(m, "tmfsmr"); goto lookupvpg; + } vm_page_busy(m); VM_OBJECT_UNLOCK(vobj); error = uiomove_fromphys(&m, offset, tlen, uio); @@ -526,8 +534,16 @@ VM_OBJECT_UNLOCK(vobj); return (error); } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { - if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) + if ((m->oflags & VPO_BUSY) != 0) { + /* + * Reference the page before unlocking and sleeping so + * that the page daemon is less likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(m, PG_REFERENCED); + vm_page_sleep(m, "tmfsmr"); goto lookupvpg; + } vm_page_busy(m); VM_OBJECT_UNLOCK(vobj); sched_pin(); @@ -627,8 +643,16 @@ lookupvpg: if (((vpg = vm_page_lookup(vobj, idx)) != NULL) && vm_page_is_valid(vpg, offset, tlen)) { - if (vm_page_sleep_if_busy(vpg, FALSE, "tmfsmw")) + if ((vpg->oflags & VPO_BUSY) != 0) { + /* + * Reference the page before unlocking and sleeping so + * that the page daemon is less likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(vpg, PG_REFERENCED); + vm_page_sleep(vpg, "tmfsmw"); goto lookupvpg; + } vm_page_busy(vpg); vm_page_lock_queues(); vm_page_undirty(vpg); ==== //depot/projects/scottl-camlock/src/sys/kern/uipc_syscalls.c#36 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.293 2010/03/19 10:46:54 kib Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.294 2010/05/02 19:25:22 kib Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -2108,6 +2108,7 @@ mbstat.sf_iocnt++; } if (error) { + vm_page_lock(pg); vm_page_lock_queues(); vm_page_unwire(pg, 0); /* @@ -2121,6 +2122,7 @@ vm_page_free(pg); } vm_page_unlock_queues(); + vm_page_unlock(pg); VM_OBJECT_UNLOCK(obj); if (error == EAGAIN) error = 0; /* not a real error */ ==== //depot/projects/scottl-camlock/src/sys/kern/vfs_bio.c#25 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/vfs_bio.c,v 1.571 2010/04/30 00:46:43 kmacy Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/vfs_bio.c,v 1.573 2010/05/02 19:10:27 alc Exp $"); #include #include @@ -1563,7 +1563,6 @@ vm_page_t m; VM_OBJECT_LOCK(bp->b_bufobj->bo_object); - vm_page_lock_queues(); for (i = 0; i < bp->b_npages; i++) { m = bp->b_pages[i]; bp->b_pages[i] = NULL; @@ -1571,16 +1570,16 @@ * In order to keep page LRU ordering consistent, put * everything on the inactive queue. */ + vm_page_lock(m); + vm_page_lock_queues(); vm_page_unwire(m, 0); /* * We don't mess with busy pages, it is * the responsibility of the process that * busied the pages to deal with them. */ - if ((m->oflags & VPO_BUSY) || (m->busy != 0)) - continue; - - if (m->wire_count == 0) { + if ((m->oflags & VPO_BUSY) == 0 && m->busy == 0 && + m->wire_count == 0) { /* * Might as well free the page if we can and it has * no valid data. We also free the page if the @@ -1595,8 +1594,9 @@ vm_page_try_to_cache(m); } } + vm_page_unlock_queues(); + vm_page_unlock(m); } - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); pmap_qremove(trunc_page((vm_offset_t) bp->b_data), bp->b_npages); @@ -3024,8 +3024,17 @@ * vm_fault->getpages->cluster_read->allocbuf * */ - if (vm_page_sleep_if_busy(m, FALSE, "pgtblk")) + if ((m->oflags & VPO_BUSY) != 0) { + /* + * Reference the page before unlocking + * and sleeping so that the page daemon + * is less likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(m, PG_REFERENCED); + vm_page_sleep(m, "pgtblk"); continue; + } /* * We have a good page. ==== //depot/projects/scottl-camlock/src/sys/mips/cavium/uart_dev_oct16550.c#2 (text+ko) ==== @@ -55,7 +55,7 @@ #include -__FBSDID("$FreeBSD: src/sys/mips/cavium/uart_dev_oct16550.c,v 1.2 2010/01/11 04:29:26 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/mips/cavium/uart_dev_oct16550.c,v 1.3 2010/05/02 19:07:19 marius Exp $"); #include #include @@ -644,12 +644,9 @@ if (ipend) octeon_led_run_wheel(&where1, 6 + device_get_unit(sc->sc_dev)); #endif - return ((sc->sc_leaving) ? 0 : ipend); + return (ipend); } - - - static int oct16550_bus_param (struct uart_softc *sc, int baudrate, int databits, int stopbits, int parity) ==== //depot/projects/scottl-camlock/src/sys/modules/Makefile#51 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/modules/Makefile,v 1.650 2010/04/14 20:45:33 yongari Exp $ +# $FreeBSD: src/sys/modules/Makefile,v 1.651 2010/05/02 19:28:30 mav Exp $ .include ==== //depot/projects/scottl-camlock/src/sys/sparc64/sparc64/interrupt.S#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/interrupt.S,v 1.11 2009/12/23 20:23:04 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/sparc64/sparc64/interrupt.S,v 1.12 2010/05/02 12:08:15 marius Exp $"); #include #include @@ -83,8 +83,11 @@ * The 2nd word points to code to execute and the 3rd is an argument * to pass. Jump to it. */ - brnz,a,pt %g3, 1f - nop + brnz,pt %g3, 1f + /* + * NB: Zeus CPUs set some undocumented bits in the first data word. + */ + and %g3, IV_MAX - 1, %g3 jmpl %g4, %g0 nop /* NOTREACHED */ ==== //depot/projects/scottl-camlock/src/sys/vm/vm_contig.c#23 (text+ko) ==== @@ -60,7 +60,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/vm/vm_contig.c,v 1.76 2010/04/30 21:20:14 kmacy Exp $"); +__FBSDID("$FreeBSD: src/sys/vm/vm_contig.c,v 1.77 2010/05/02 16:44:06 alc Exp $"); #include #include @@ -96,33 +96,33 @@ vm_page_t m_tmp; struct vnode *vp; struct mount *mp; - int vfslocked, dirty; + int vfslocked; - vm_page_lock(m); - vm_page_lock_queues(); + mtx_assert(&vm_page_queue_mtx, MA_OWNED); + vm_page_lock_assert(m, MA_OWNED); object = m->object; if (!VM_OBJECT_TRYLOCK(object) && !vm_pageout_fallback_object_lock(m, next)) { + vm_page_unlock(m); VM_OBJECT_UNLOCK(object); - vm_page_unlock_queues(); - vm_page_unlock(m); return (EAGAIN); } if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) { VM_OBJECT_UNLOCK(object); + vm_page_lock_queues(); return (EBUSY); } vm_page_test_dirty(m); if (m->dirty == 0 && m->hold_count == 0) pmap_remove_all(m); - if ((dirty = m->dirty) != 0) { - vm_page_unlock_queues(); + if (m->dirty != 0) { vm_page_unlock(m); if ((object->flags & OBJ_DEAD) != 0) { VM_OBJECT_UNLOCK(object); return (EAGAIN); } if (object->type == OBJT_VNODE) { + vm_page_unlock_queues(); vp = object->handle; vm_object_reference_locked(object); VM_OBJECT_UNLOCK(object); @@ -136,19 +136,20 @@ VFS_UNLOCK_GIANT(vfslocked); vm_object_deallocate(object); vn_finished_write(mp); + vm_page_lock_queues(); return (0); } else if (object->type == OBJT_SWAP || object->type == OBJT_DEFAULT) { + vm_page_unlock_queues(); m_tmp = m; vm_pageout_flush(&m_tmp, 1, VM_PAGER_PUT_SYNC); VM_OBJECT_UNLOCK(object); + vm_page_lock_queues(); return (0); } - } else if (m->hold_count == 0) - vm_page_cache(m); - - if (dirty == 0) { - vm_page_unlock_queues(); + } else { + if (m->hold_count == 0) + vm_page_cache(m); vm_page_unlock(m); } VM_OBJECT_UNLOCK(object); @@ -167,11 +168,12 @@ if ((m->flags & PG_MARKER) != 0) continue; + if (!vm_page_trylock(m)) + continue; KASSERT(VM_PAGE_INQUEUE2(m, queue), ("vm_contig_launder: page %p's queue is not %d", m, queue)); - vm_page_unlock_queues(); error = vm_contig_launder_page(m, &next); - vm_page_lock_queues(); + vm_page_lock_assert(m, MA_NOTOWNED); if (error == 0) return (TRUE); if (error == EBUSY) ==== //depot/projects/scottl-camlock/src/sys/vm/vm_fault.c#34 (text+ko) ==== @@ -72,7 +72,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/vm/vm_fault.c,v 1.269 2010/04/30 16:20:14 kib Exp $"); +__FBSDID("$FreeBSD: src/sys/vm/vm_fault.c,v 1.270 2010/05/02 17:33:46 alc Exp $"); #include "opt_vm.h" @@ -338,6 +338,12 @@ * to pmap it. */ if ((fs.m->oflags & VPO_BUSY) || fs.m->busy) { + /* + * Reference the page before unlocking and + * sleeping so that the page daemon is less + * likely to reclaim it. + */ + vm_page_flag_set(fs.m, PG_REFERENCED); vm_page_unlock_queues(); vm_page_unlock(fs.m); VM_OBJECT_UNLOCK(fs.object); ==== //depot/projects/scottl-camlock/src/sys/vm/vm_object.c#25 (text+ko) ==== @@ -63,7 +63,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/vm/vm_object.c,v 1.416 2010/04/30 22:31:37 kmacy Exp $"); +__FBSDID("$FreeBSD: src/sys/vm/vm_object.c,v 1.417 2010/05/02 18:09:33 alc Exp $"); #include "opt_vm.h" @@ -1454,7 +1454,6 @@ * not be changed by this operation. */ if ((m->oflags & VPO_BUSY) || m->busy) { - vm_page_unlock_queues(); VM_OBJECT_UNLOCK(new_object); m->oflags |= VPO_WANTED; msleep(m, VM_OBJECT_MTX(orig_object), PVM, "spltwt", 0); ==== //depot/projects/scottl-camlock/src/sys/vm/vm_page.c#28 (text+ko) ==== @@ -98,7 +98,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/vm/vm_page.c,v 1.386 2010/04/30 02:46:49 kmacy Exp $"); +__FBSDID("$FreeBSD: src/sys/vm/vm_page.c,v 1.387 2010/05/02 17:33:46 alc Exp $"); #include "opt_vm.h" @@ -599,7 +599,7 @@ /* * vm_page_sleep: * - * Sleep and release the page queues lock. + * Sleep and release the page and page queues locks. * * The object containing the given page must be locked. */ @@ -608,13 +608,10 @@ { VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); - if (!mtx_owned(vm_page_lockptr(m))) - vm_page_lock(m); - if (!mtx_owned(&vm_page_queue_mtx)) - vm_page_lock_queues(); - vm_page_flag_set(m, PG_REFERENCED); - vm_page_unlock_queues(); - vm_page_unlock(m); + if (mtx_owned(&vm_page_queue_mtx)) + vm_page_unlock_queues(); + if (mtx_owned(vm_page_lockptr(m))) + vm_page_unlock(m); /* * It's possible that while we sleep, the page will get @@ -1896,7 +1893,17 @@ VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); retrylookup: if ((m = vm_page_lookup(object, pindex)) != NULL) { - if (vm_page_sleep_if_busy(m, TRUE, "pgrbwt")) { + if ((m->oflags & VPO_BUSY) != 0 || m->busy != 0) { + if ((allocflags & VM_ALLOC_RETRY) != 0) { + /* + * Reference the page before unlocking and + * sleeping so that the page daemon is less + * likely to reclaim it. + */ + vm_page_lock_queues(); + vm_page_flag_set(m, PG_REFERENCED); + } + vm_page_sleep(m, "pgrbwt"); if ((allocflags & VM_ALLOC_RETRY) == 0) return (NULL); goto retrylookup;