1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Eliminate unnecessary obfuscation when testing a page's valid bits.

This commit is contained in:
Alan Cox 2009-06-07 19:38:26 +00:00
parent db77ea6c22
commit 0a2e596a93
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=193643
5 changed files with 8 additions and 11 deletions

View File

@ -927,7 +927,7 @@ exec_map_first_page(imgp)
} }
#endif #endif
ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
if ((ma[0]->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) { if (ma[0]->valid != VM_PAGE_BITS_ALL) {
initial_pagein = VM_INITIAL_PAGEIN; initial_pagein = VM_INITIAL_PAGEIN;
if (initial_pagein > object->size) if (initial_pagein > object->size)
initial_pagein = object->size; initial_pagein = object->size;

View File

@ -455,7 +455,7 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
bp->b_pages[bp->b_npages] = m; bp->b_pages[bp->b_npages] = m;
bp->b_npages++; bp->b_npages++;
} }
if ((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) if (m->valid == VM_PAGE_BITS_ALL)
tbp->b_pages[j] = bogus_page; tbp->b_pages[j] = bogus_page;
} }
VM_OBJECT_UNLOCK(tbp->b_bufobj->bo_object); VM_OBJECT_UNLOCK(tbp->b_bufobj->bo_object);
@ -482,11 +482,9 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
VM_OBJECT_LOCK(bp->b_bufobj->bo_object); VM_OBJECT_LOCK(bp->b_bufobj->bo_object);
for (j = 0; j < bp->b_npages; j++) { for (j = 0; j < bp->b_npages; j++) {
VM_OBJECT_LOCK_ASSERT(bp->b_pages[j]->object, MA_OWNED); VM_OBJECT_LOCK_ASSERT(bp->b_pages[j]->object, MA_OWNED);
if ((bp->b_pages[j]->valid & VM_PAGE_BITS_ALL) == if (bp->b_pages[j]->valid == VM_PAGE_BITS_ALL)
VM_PAGE_BITS_ALL) {
bp->b_pages[j] = bogus_page; bp->b_pages[j] = bogus_page;
} }
}
VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object); VM_OBJECT_UNLOCK(bp->b_bufobj->bo_object);
if (bp->b_bufsize > bp->b_kvasize) if (bp->b_bufsize > bp->b_kvasize)
panic("cluster_rbuild: b_bufsize(%ld) > b_kvasize(%d)\n", panic("cluster_rbuild: b_bufsize(%ld) > b_kvasize(%d)\n",

View File

@ -394,7 +394,7 @@ RetryFault:;
* found the page ). * found the page ).
*/ */
vm_page_busy(fs.m); vm_page_busy(fs.m);
if (((fs.m->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) && if (fs.m->valid != VM_PAGE_BITS_ALL &&
fs.m->object != kernel_object && fs.m->object != kmem_object) { fs.m->object != kernel_object && fs.m->object != kmem_object) {
goto readrest; goto readrest;
} }
@ -433,7 +433,7 @@ RetryFault:;
unlock_and_deallocate(&fs); unlock_and_deallocate(&fs);
VM_WAITPFAULT; VM_WAITPFAULT;
goto RetryFault; goto RetryFault;
} else if ((fs.m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) } else if (fs.m->valid == VM_PAGE_BITS_ALL)
break; break;
} }
@ -1024,9 +1024,8 @@ vm_fault_prefault(pmap_t pmap, vm_offset_t addra, vm_map_entry_t entry)
VM_OBJECT_UNLOCK(lobject); VM_OBJECT_UNLOCK(lobject);
break; break;
} }
if (((m->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) && if (m->valid == VM_PAGE_BITS_ALL &&
(m->flags & PG_FICTITIOUS) == 0) { (m->flags & PG_FICTITIOUS) == 0) {
vm_page_lock_queues(); vm_page_lock_queues();
pmap_enter_quick(pmap, addr, m, entry->protection); pmap_enter_quick(pmap, addr, m, entry->protection);
vm_page_unlock_queues(); vm_page_unlock_queues();

View File

@ -253,7 +253,7 @@ vm_imgact_hold_page(vm_object_t object, vm_ooffset_t offset)
VM_OBJECT_LOCK(object); VM_OBJECT_LOCK(object);
pindex = OFF_TO_IDX(offset); pindex = OFF_TO_IDX(offset);
m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY); m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
if ((m->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL) { if (m->valid != VM_PAGE_BITS_ALL) {
ma[0] = m; ma[0] = m;
rv = vm_pager_get_pages(object, ma, 1, 0); rv = vm_pager_get_pages(object, ma, 1, 0);
m = vm_page_lookup(object, pindex); m = vm_page_lookup(object, pindex);

View File

@ -1683,7 +1683,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_prot_t prot,
psize = tmpidx; psize = tmpidx;
break; break;
} }
if ((p->valid & VM_PAGE_BITS_ALL) == VM_PAGE_BITS_ALL) { if (p->valid == VM_PAGE_BITS_ALL) {
if (p_start == NULL) { if (p_start == NULL) {
start = addr + ptoa(tmpidx); start = addr + ptoa(tmpidx);
p_start = p; p_start = p;