Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm use queue.h macros and KASSERT().



details:   https://anonhg.NetBSD.org/src/rev/73f32d754bf9
branches:  trunk
changeset: 499696:73f32d754bf9
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Nov 27 07:47:42 2000 +0000

description:
use queue.h macros and KASSERT().

diffstat:

 sys/uvm/uvm_page_i.h |  25 +++++++------------------
 1 files changed, 7 insertions(+), 18 deletions(-)

diffs (79 lines):

diff -r fedd9df2efd5 -r 73f32d754bf9 sys/uvm/uvm_page_i.h
--- a/sys/uvm/uvm_page_i.h      Mon Nov 27 06:38:54 2000 +0000
+++ b/sys/uvm/uvm_page_i.h      Mon Nov 27 07:47:42 2000 +0000
@@ -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 @@
 
        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 @@
 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 @@
 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 @@
                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 @@
                 * 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 @@
        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);
 }
 



Home | Main Index | Thread Index | Old Index