From owner-freebsd-usb@FreeBSD.ORG Wed Feb 1 13:58:28 2006 Return-Path: X-Original-To: freebsd-usb@freebsd.org Delivered-To: freebsd-usb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DA3CE16A420 for ; Wed, 1 Feb 2006 13:58:28 +0000 (GMT) (envelope-from tinguely@casselton.net) Received: from casselton.net (casselton.net [63.165.140.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 30A9943D49 for ; Wed, 1 Feb 2006 13:58:28 +0000 (GMT) (envelope-from tinguely@casselton.net) Received: from casselton.net (localhost [127.0.0.1]) by casselton.net (8.12.11/8.12.11) with ESMTP id k11DwPXO043639; Wed, 1 Feb 2006 07:58:25 -0600 (CST) (envelope-from tinguely@casselton.net) Received: (from tinguely@localhost) by casselton.net (8.12.11/8.12.11/Submit) id k11DwPuw043638; Wed, 1 Feb 2006 07:58:25 -0600 (CST) (envelope-from tinguely) Date: Wed, 1 Feb 2006 07:58:25 -0600 (CST) From: Mark Tinguely Message-Id: <200602011358.k11DwPuw043638@casselton.net> To: nox@jelal.kn-bremen.de, peterjeremy@optushome.com.au In-Reply-To: <20060201062445.GC678@turion.vk2pj.dyndns.org> X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on ccn.casselton.net Cc: iedowse@iedowse.com, tinguely@casselton.net, freebsd-usb@freebsd.org Subject: Re: cvs commit: src/sys/dev/usb ehci.c ehci_pci.c ehcivar.h X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2006 13:58:29 -0000 The files at http://www.casselton.net/~tinguely/vmcontig/ also has some performance changes that flipped the page scanning from back to front to front to back. The official FreeBSD vm_contig.c v 1.48 also adds some simple shortcuts to speed initial allocation for those that have physical memory >> 4GB by start scanning closer to the 4GB address when the allocation must be below 4 GB. This does not help those with the 1GB - 4GB of physical memory. But right now the back to front page scanning is going to remain to keep the lower physical addresses available for ISA devices.... If you just want to try to fix the interupt page cleaning panic: *** vm_contig.c Mon Jan 30 09:22:51 2006 --- vm_contig.c.nowait Wed Feb 1 07:51:33 2006 *************** *** 86,92 **** #include static int ! vm_contig_launder_page(vm_page_t m) { vm_object_t object; vm_page_t m_tmp; --- 86,92 ---- #include static int ! vm_contig_launder_page(vm_page_t m, int flags) { vm_object_t object; vm_page_t m_tmp; *************** *** 95,100 **** --- 95,114 ---- object = m->object; if (!VM_OBJECT_TRYLOCK(object)) return (EAGAIN); + + if (flags & M_NOWAIT) { /* cannot sleep in interrupt mode */ + if ((m->flags & PG_BUSY) || m->busy) { + VM_OBJECT_UNLOCK(object); + return (EBUSY); + } else { + vm_page_test_dirty(m); + if (m->dirty) { + VM_OBJECT_UNLOCK(object); + return (EAGAIN); + } + } + } + if (vm_page_sleep_if_busy(m, TRUE, "vpctw0")) { VM_OBJECT_UNLOCK(object); vm_page_lock_queues(); *************** *** 129,135 **** } static int ! vm_contig_launder(int queue) { vm_page_t m, next; int error; --- 143,149 ---- } static int ! vm_contig_launder(int queue, int flags) { vm_page_t m, next; int error; *************** *** 143,149 **** KASSERT(VM_PAGE_INQUEUE2(m, queue), ("vm_contig_launder: page %p's queue is not %d", m, queue)); ! error = vm_contig_launder_page(m); if (error == 0) return (TRUE); if (error == EBUSY) --- 157,163 ---- KASSERT(VM_PAGE_INQUEUE2(m, queue), ("vm_contig_launder: page %p's queue is not %d", m, queue)); ! error = vm_contig_launder_page(m, flags); if (error == 0) return (TRUE); if (error == EBUSY) *************** *** 224,235 **** actmax = vm_page_queues[PQ_ACTIVE].lcnt; again1: if (inactl < inactmax && ! vm_contig_launder(PQ_INACTIVE)) { inactl++; goto again1; } if (actl < actmax && ! vm_contig_launder(PQ_ACTIVE)) { actl++; goto again1; } --- 238,249 ---- actmax = vm_page_queues[PQ_ACTIVE].lcnt; again1: if (inactl < inactmax && ! vm_contig_launder(PQ_INACTIVE, flags)) { inactl++; goto again1; } if (actl < actmax && ! vm_contig_launder(PQ_ACTIVE, flags)) { actl++; goto again1; } *************** *** 381,387 **** vm_page_t vm_page_alloc_contig(vm_pindex_t npages, vm_paddr_t low, vm_paddr_t high, ! vm_offset_t alignment, vm_offset_t boundary) { vm_object_t object; vm_offset_t size; --- 395,401 ---- vm_page_t vm_page_alloc_contig(vm_pindex_t npages, vm_paddr_t low, vm_paddr_t high, ! vm_offset_t alignment, vm_offset_t boundary, int flags) { vm_object_t object; vm_offset_t size; *************** *** 474,480 **** pqtype != PQ_CACHE) { if (m->queue == PQ_ACTIVE || m->queue == PQ_INACTIVE) { ! if (vm_contig_launder_page(m) != 0) goto cleanup_freed; pqtype = m->queue - m->pc; if (pqtype != PQ_FREE && --- 488,494 ---- pqtype != PQ_CACHE) { if (m->queue == PQ_ACTIVE || m->queue == PQ_INACTIVE) { ! if (vm_contig_launder_page(m, flags) != 0) goto cleanup_freed; pqtype = m->queue - m->pc; if (pqtype != PQ_FREE && *************** *** 581,587 **** boundary, kernel_map); } else { pages = vm_page_alloc_contig(npgs, low, high, ! alignment, boundary); if (pages == NULL) { ret = NULL; } else { --- 595,601 ---- boundary, kernel_map); } else { pages = vm_page_alloc_contig(npgs, low, high, ! alignment, boundary, flags); if (pages == NULL) { ret = NULL; } else { *** vm_page.h Wed Jan 25 09:01:28 2006 --- vm_page.h.nowait Wed Feb 1 07:50:32 2006 *************** *** 321,327 **** void vm_page_activate (vm_page_t); vm_page_t vm_page_alloc (vm_object_t, vm_pindex_t, int); vm_page_t vm_page_alloc_contig (vm_pindex_t, vm_paddr_t, vm_paddr_t, ! vm_offset_t, vm_offset_t); void vm_page_release_contig (vm_page_t, vm_pindex_t); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); void vm_page_cache (register vm_page_t); --- 321,327 ---- void vm_page_activate (vm_page_t); vm_page_t vm_page_alloc (vm_object_t, vm_pindex_t, int); vm_page_t vm_page_alloc_contig (vm_pindex_t, vm_paddr_t, vm_paddr_t, ! vm_offset_t, vm_offset_t, int); void vm_page_release_contig (vm_page_t, vm_pindex_t); vm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int); void vm_page_cache (register vm_page_t);