svn commit: r216807 - head/sys/vm

Alan Cox alc at FreeBSD.org
Wed Dec 29 20:35:36 UTC 2010


Author: alc
Date: Wed Dec 29 20:35:36 2010
New Revision: 216807
URL: http://svn.freebsd.org/changeset/base/216807

Log:
  There is no point in vm_contig_launder{,_page}() flushing held pages,
  instead skip over them.  As long as a page is held, it can't be reclaimed by
  contigmalloc(M_WAITOK).  Moreover, a held page may be undergoing
  modification, e.g., vmapbuf(), so even if the hold were released before the
  completion of contigmalloc(), the page might have to be flushed again.
  
  MFC after:	3 weeks

Modified:
  head/sys/vm/vm_contig.c

Modified: head/sys/vm/vm_contig.c
==============================================================================
--- head/sys/vm/vm_contig.c	Wed Dec 29 19:39:51 2010	(r216806)
+++ head/sys/vm/vm_contig.c	Wed Dec 29 20:35:36 2010	(r216807)
@@ -100,7 +100,7 @@ vm_contig_launder_page(vm_page_t m, vm_p
 	vm_page_lock_assert(m, MA_OWNED);
 	object = m->object;
 	if (!VM_OBJECT_TRYLOCK(object) &&
-	    !vm_pageout_fallback_object_lock(m, next)) {
+	    (!vm_pageout_fallback_object_lock(m, next) || m->hold_count != 0)) {
 		vm_page_unlock(m);
 		VM_OBJECT_UNLOCK(object);
 		return (EAGAIN);
@@ -111,7 +111,7 @@ vm_contig_launder_page(vm_page_t m, vm_p
 		return (EBUSY);
 	}
 	vm_page_test_dirty(m);
-	if (m->dirty == 0 && m->hold_count == 0)
+	if (m->dirty == 0)
 		pmap_remove_all(m);
 	if (m->dirty != 0) {
 		vm_page_unlock(m);
@@ -146,8 +146,7 @@ vm_contig_launder_page(vm_page_t m, vm_p
 			return (0);
 		}
 	} else {
-		if (m->hold_count == 0)
-			vm_page_cache(m);
+		vm_page_cache(m);
 		vm_page_unlock(m);
 	}
 	VM_OBJECT_UNLOCK(object);
@@ -171,7 +170,7 @@ vm_contig_launder(int queue, vm_paddr_t 
 		if (pa < low || pa + PAGE_SIZE > high)
 			continue;
 
-		if (!vm_pageout_page_lock(m, &next)) {
+		if (!vm_pageout_page_lock(m, &next) || m->hold_count != 0) {
 			vm_page_unlock(m);
 			continue;
 		}


More information about the svn-src-head mailing list