Strive for greater consistency among the places that implement real,
fictious, and contiguous page allocation. Eliminate unnecessary reinitialization of a page's fields.
This commit is contained in:
parent
c0a8cee371
commit
6f0489c670
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=194562
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -689,6 +689,14 @@ vm_phys_alloc_contig(unsigned long npages, vm_paddr_t low, vm_paddr_t high,
|
||||
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 @@ vm_phys_alloc_contig(unsigned long npages, vm_paddr_t low, vm_paddr_t high,
|
||||
/* 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user