summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2009-06-21 00:21:33 +0000
committeralc <alc@FreeBSD.org>2009-06-21 00:21:33 +0000
commit7b05ffed76747ad78e9d871322b18ca60e6b8693 (patch)
tree74b0d998b0bb25128f0f355d5229959a3c7ac2f6
parentda6735320825654d2417fed4a078082641fa4cdf (diff)
downloadFreeBSD-src-7b05ffed76747ad78e9d871322b18ca60e6b8693.zip
FreeBSD-src-7b05ffed76747ad78e9d871322b18ca60e6b8693.tar.gz
Strive for greater consistency among the places that implement real,
fictious, and contiguous page allocation. Eliminate unnecessary reinitialization of a page's fields.
-rw-r--r--sys/vm/device_pager.c1
-rw-r--r--sys/vm/vm_page.c17
-rw-r--r--sys/vm/vm_phys.c13
3 files changed, 18 insertions, 13 deletions
diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c
index 5e31e2b..5472d64 100644
--- a/sys/vm/device_pager.c
+++ b/sys/vm/device_pager.c
@@ -307,6 +307,7 @@ dev_pager_getfake(paddr)
m->flags = PG_FICTITIOUS;
m->oflags = VPO_BUSY;
+ /* Fictitious pages don't use "act_count". */
m->valid = VM_PAGE_BITS_ALL;
m->dirty = 0;
m->busy = 0;
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 370aea0..7148fdc 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1108,10 +1108,13 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
* At this point we had better have found a good page.
*/
- KASSERT(
- m != NULL,
- ("vm_page_alloc(): missing page on free queue")
- );
+ KASSERT(m != NULL, ("vm_page_alloc: missing page"));
+ KASSERT(m->queue == PQ_NONE, ("vm_page_alloc: page %p has unexpected queue %d",
+ m, m->queue));
+ KASSERT(m->wire_count == 0, ("vm_page_alloc: page %p is wired", m));
+ KASSERT(m->hold_count == 0, ("vm_page_alloc: page %p is held", m));
+ KASSERT(m->busy == 0, ("vm_page_alloc: page %p is busy", m));
+ KASSERT(m->dirty == 0, ("vm_page_alloc: page %p is dirty", m));
if ((m->flags & PG_CACHED) != 0) {
KASSERT(m->valid != 0,
("vm_page_alloc: cached page %p is invalid", m));
@@ -1150,12 +1153,8 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
if (req & VM_ALLOC_WIRED) {
atomic_add_int(&cnt.v_wire_count, 1);
m->wire_count = 1;
- } else
- m->wire_count = 0;
- m->hold_count = 0;
+ }
m->act_count = 0;
- m->busy = 0;
- KASSERT(m->dirty == 0, ("vm_page_alloc: free/cache page %p was dirty", m));
mtx_unlock(&vm_page_queue_free_mtx);
if ((req & VM_ALLOC_NOOBJ) == 0)
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index b6d1cb3..0de35cd 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -689,6 +689,14 @@ done:
KASSERT(m->queue == PQ_NONE,
("vm_phys_alloc_contig: page %p has unexpected queue %d",
m, m->queue));
+ KASSERT(m->wire_count == 0,
+ ("vm_phys_alloc_contig: page %p is wired", m));
+ KASSERT(m->hold_count == 0,
+ ("vm_phys_alloc_contig: page %p is held", m));
+ KASSERT(m->busy == 0,
+ ("vm_phys_alloc_contig: page %p is busy", m));
+ KASSERT(m->dirty == 0,
+ ("vm_phys_alloc_contig: page %p is dirty", m));
m_object = m->object;
if ((m->flags & PG_CACHED) != 0) {
m->valid = 0;
@@ -705,10 +713,7 @@ done:
/* Don't clear the PG_ZERO flag; we'll need it later. */
m->flags = PG_UNMANAGED | (m->flags & PG_ZERO);
m->oflags = 0;
- KASSERT(m->dirty == 0,
- ("vm_phys_alloc_contig: page %p was dirty", m));
- m->wire_count = 0;
- m->busy = 0;
+ /* Unmanaged pages don't use "act_count". */
if (m_object != NULL &&
m_object->type == OBJT_VNODE &&
m_object->cache == NULL) {
OpenPOWER on IntegriCloud