aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2009-06-17 04:57:32 +0000
committerAlan Cox <alc@FreeBSD.org>2009-06-17 04:57:32 +0000
commitead1d027bd75652615e4a07c7007ad891fb47e76 (patch)
treed4456f2d3985c91f2ad8478d6d2353bb7b7f2bdf /sys
parent615f88eca6750482a07009dd468f79850af18bbc (diff)
downloadsrc-ead1d027bd75652615e4a07c7007ad891fb47e76.tar.gz
src-ead1d027bd75652615e4a07c7007ad891fb47e76.zip
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.
Notes
Notes: svn path=/head/; revision=194331
Diffstat (limited to 'sys')
-rw-r--r--sys/vm/vm_contig.c1
-rw-r--r--sys/vm/vm_phys.c8
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/vm/vm_contig.c b/sys/vm/vm_contig.c
index 6c82e147b9bd..845077c6b016 100644
--- a/sys/vm/vm_contig.c
+++ b/sys/vm/vm_contig.c
@@ -218,6 +218,7 @@ contigmapping(vm_page_t m, vm_pindex_t npages, int flags)
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);
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index 3af40cf7bf2c..9c140a59c433 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -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. */