svn commit: r194331 - head/sys/vm

Alan Cox alc at FreeBSD.org
Wed Jun 17 04:57:34 UTC 2009


Author: alc
Date: Wed Jun 17 04:57:32 2009
New Revision: 194331
URL: http://svn.freebsd.org/changeset/base/194331

Log:
  Make the maintenance of a page's valid bits by contigmalloc() more like
  kmem_alloc() and kmem_malloc().  Specifically, defer the setting of the
  page's valid bits until contigmapping() when the mapping is known to be
  successful.

Modified:
  head/sys/vm/vm_contig.c
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/vm_contig.c
==============================================================================
--- head/sys/vm/vm_contig.c	Wed Jun 17 04:23:37 2009	(r194330)
+++ head/sys/vm/vm_contig.c	Wed Jun 17 04:57:32 2009	(r194331)
@@ -218,6 +218,7 @@ contigmapping(vm_page_t m, vm_pindex_t n
 		    OFF_TO_IDX(tmp_addr - VM_MIN_KERNEL_ADDRESS));
 		if ((flags & M_ZERO) && !(m[i].flags & PG_ZERO))
 			pmap_zero_page(&m[i]);
+		m[i].valid = VM_PAGE_BITS_ALL;
 		tmp_addr += PAGE_SIZE;
 	}
 	VM_OBJECT_UNLOCK(object);

Modified: head/sys/vm/vm_phys.c
==============================================================================
--- head/sys/vm/vm_phys.c	Wed Jun 17 04:23:37 2009	(r194330)
+++ head/sys/vm/vm_phys.c	Wed Jun 17 04:57:32 2009	(r194331)
@@ -691,14 +691,16 @@ done:
 		    ("vm_phys_alloc_contig: page %p has unexpected queue %d",
 		    m, m->queue));
 		m_object = m->object;
-		if ((m->flags & PG_CACHED) != 0)
+		if ((m->flags & PG_CACHED) != 0) {
+			m->valid = 0;
 			vm_page_cache_remove(m);
-		else {
+		} else {
 			KASSERT(VM_PAGE_IS_FREE(m),
 			    ("vm_phys_alloc_contig: page %p is not free", m));
+			KASSERT(m->valid == 0,
+			    ("vm_phys_alloc_contig: free page %p is valid", m));
 			cnt.v_free_count--;
 		}
-		m->valid = VM_PAGE_BITS_ALL;
 		if (m->flags & PG_ZERO)
 			vm_page_zero_count--;
 		/* Don't clear the PG_ZERO flag; we'll need it later. */


More information about the svn-src-head mailing list