cvs commit: src/sys/dev/usb ehci.c ehci_pci.c ehcivar.h

Mark Tinguely tinguely at casselton.net
Wed Feb 1 05:58:29 PST 2006


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 <vm/vm_extern.h>
  
  static int
! vm_contig_launder_page(vm_page_t m)
  {
  	vm_object_t object;
  	vm_page_t m_tmp;
--- 86,92 ----
  #include <vm/vm_extern.h>
  
  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);


More information about the freebsd-usb mailing list