use queue.h macros and KASSERT().

This commit is contained in:
chs 2000-11-27 07:47:42 +00:00
parent a5dad0db13
commit 1ec37ad27a

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_page_i.h,v 1.13 2000/05/08 23:11:53 thorpej Exp $ */
/* $NetBSD: uvm_page_i.h,v 1.14 2000/11/27 07:47:42 chs Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@ -133,16 +133,14 @@ uvm_pagelookup(obj, off)
s = splimp();
simple_lock(&uvm.hashlock);
for (pg = buck->tqh_first ; pg != NULL ; pg = pg->hashq.tqe_next) {
TAILQ_FOREACH(pg, buck, hashq) {
if (pg->uobject == obj && pg->offset == off) {
simple_unlock(&uvm.hashlock);
splx(s);
return(pg);
break;
}
}
simple_unlock(&uvm.hashlock);
splx(s);
return(NULL);
return(pg);
}
/*
@ -155,7 +153,6 @@ PAGE_INLINE void
uvm_pagewire(pg)
struct vm_page *pg;
{
if (pg->wire_count == 0) {
if (pg->pqflags & PQ_ACTIVE) {
TAILQ_REMOVE(&uvm.page_active, pg, pageq);
@ -186,7 +183,6 @@ PAGE_INLINE void
uvm_pageunwire(pg)
struct vm_page *pg;
{
pg->wire_count--;
if (pg->wire_count == 0) {
TAILQ_INSERT_TAIL(&uvm.page_active, pg, pageq);
@ -214,11 +210,7 @@ uvm_pagedeactivate(pg)
uvmexp.active--;
}
if ((pg->pqflags & PQ_INACTIVE) == 0) {
#ifdef DIAGNOSTIC
if (__predict_false(pg->wire_count))
panic("uvm_pagedeactivate: caller did not check "
"wire count");
#endif
KASSERT(pg->wire_count == 0);
if (pg->pqflags & PQ_SWAPBACKED)
TAILQ_INSERT_TAIL(&uvm.page_inactive_swp, pg, pageq);
else
@ -256,7 +248,7 @@ uvm_pageactivate(pg)
* can put it at tail. if it wasn't active, then mark
* it active and bump active count
*/
if (pg->pqflags & PQ_ACTIVE)
if (pg->pqflags & PQ_ACTIVE)
TAILQ_REMOVE(&uvm.page_active, pg, pageq);
else {
pg->pqflags |= PQ_ACTIVE;
@ -310,10 +302,7 @@ uvm_page_lookup_freelist(pg)
int lcv;
lcv = vm_physseg_find(atop(VM_PAGE_TO_PHYS(pg)), NULL);
#ifdef DIAGNOSTIC
if (__predict_false(lcv == -1))
panic("uvm_page_lookup_freelist: unable to locate physseg");
#endif
KASSERT(lcv != -1);
return (vm_physmem[lcv].free_list);
}