Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386 rename pv_next to pv_node. use SPLAY_RIGHT() ...



details:   https://anonhg.NetBSD.org/src/rev/3d53dfb4a5ed
branches:  trunk
changeset: 553941:3d53dfb4a5ed
user:      chs <chs%NetBSD.org@localhost>
date:      Thu Oct 23 08:30:21 2003 +0000

description:
rename pv_next to pv_node.  use SPLAY_RIGHT() instead of expanding it inline.

diffstat:

 sys/arch/i386/i386/pmap.c       |  27 ++++++++++++---------------
 sys/arch/i386/include/pmap.h    |   4 ++--
 sys/arch/i386/include/vmparam.h |   7 ++++---
 3 files changed, 18 insertions(+), 20 deletions(-)

diffs (152 lines):

diff -r c42718f8b265 -r 3d53dfb4a5ed sys/arch/i386/i386/pmap.c
--- a/sys/arch/i386/i386/pmap.c Thu Oct 23 07:49:35 2003 +0000
+++ b/sys/arch/i386/i386/pmap.c Thu Oct 23 08:30:21 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.158 2003/10/23 03:03:20 provos Exp $        */
+/*     $NetBSD: pmap.c,v 1.159 2003/10/23 08:30:21 chs Exp $   */
 
 /*
  *
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.158 2003/10/23 03:03:20 provos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.159 2003/10/23 08:30:21 chs Exp $");
 
 #include "opt_cputype.h"
 #include "opt_user_ldt.h"
@@ -403,8 +403,8 @@
                return (0);
 }
 
-SPLAY_PROTOTYPE(pvtree, pv_entry, pv_next, pv_compare);
-SPLAY_GENERATE(pvtree, pv_entry, pv_next, pv_compare);
+SPLAY_PROTOTYPE(pvtree, pv_entry, pv_node, pv_compare);
+SPLAY_GENERATE(pvtree, pv_entry, pv_node, pv_compare);
 
 /*
  * linked list of all non-kernel pmaps
@@ -1217,7 +1217,7 @@
                }
                pv = pvpage->pvinfo.pvpi_pvfree;
                KASSERT(pv);
-               pvpage->pvinfo.pvpi_pvfree = pv->pv_next.spe_right;
+               pvpage->pvinfo.pvpi_pvfree = SPLAY_RIGHT(pv, pv_node);
                pv_nfpvents--;  /* took one from pool */
        } else {
                pv = NULL;              /* need more of them */
@@ -1276,7 +1276,7 @@
                pvpage->pvinfo.pvpi_nfree--;    /* can't go to zero */
                pv = pvpage->pvinfo.pvpi_pvfree;
                KASSERT(pv);
-               pvpage->pvinfo.pvpi_pvfree = pv->pv_next.spe_right;
+               pvpage->pvinfo.pvpi_pvfree = SPLAY_RIGHT(pv, pv_node);
                pv_nfpvents--;  /* took one from pool */
                return(pv);
        }
@@ -1337,7 +1337,8 @@
        pvp->pvinfo.pvpi_pvfree = NULL;
        pvp->pvinfo.pvpi_nfree = tofree;
        for (lcv = 0 ; lcv < tofree ; lcv++) {
-               pvp->pvents[lcv].pv_next.spe_right = pvp->pvinfo.pvpi_pvfree;
+               SPLAY_RIGHT(&pvp->pvents[lcv], pv_node) =
+                       pvp->pvinfo.pvpi_pvfree;
                pvp->pvinfo.pvpi_pvfree = &pvp->pvents[lcv];
        }
        if (need_entry)
@@ -1373,7 +1374,7 @@
        }
 
        /* free it */
-       pv->pv_next.spe_right = pvp->pvinfo.pvpi_pvfree;
+       SPLAY_RIGHT(pv, pv_node) = pvp->pvinfo.pvpi_pvfree;
        pvp->pvinfo.pvpi_pvfree = pv;
 
        /*
@@ -1427,7 +1428,7 @@
        simple_lock(&pvalloc_lock);
 
        for ( /* null */ ; pvs != NULL ; pvs = nextpv) {
-               nextpv = pvs->pv_next.spe_right;
+               nextpv = SPLAY_RIGHT(pvs, pv_node);
                pmap_free_pv_doit(pvs);
        }
 
@@ -1549,14 +1550,10 @@
 
        tmp.pv_pmap = pmap;
        tmp.pv_va = va;
-
        pve = SPLAY_FIND(pvtree, &pvh->pvh_root, &tmp);
-
        if (pve == NULL)
                return (NULL);
-
        SPLAY_REMOVE(pvtree, &pvh->pvh_root, pve);
-
        return(pve);                            /* return removed pve */
 }
 
@@ -2234,7 +2231,7 @@
                simple_unlock(&mdpg->mp_pvhead.pvh_lock);
 
                if (pve) {
-                       pve->pv_next.spe_right = pv_tofree;
+                       SPLAY_RIGHT(pve, pv_node) = pv_tofree;
                        pv_tofree = pve;
                }
 
@@ -2625,7 +2622,7 @@
                }
                pmap_unmap_ptes(pve->pv_pmap);          /* unlocks pmap */
                SPLAY_REMOVE(pvtree, &pvh->pvh_root, pve); /* remove it */
-               pve->pv_next.spe_right = killlist;      /* mark it for death */
+               SPLAY_RIGHT(pve, pv_node) = killlist;   /* mark it for death */
                killlist = pve;
        }
        pmap_free_pvs(NULL, killlist);
diff -r c42718f8b265 -r 3d53dfb4a5ed sys/arch/i386/include/pmap.h
--- a/sys/arch/i386/include/pmap.h      Thu Oct 23 07:49:35 2003 +0000
+++ b/sys/arch/i386/include/pmap.h      Thu Oct 23 08:30:21 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.76 2003/10/23 03:03:20 provos Exp $ */
+/*     $NetBSD: pmap.h,v 1.77 2003/10/23 08:30:21 chs Exp $    */
 
 /*
  *
@@ -268,7 +268,7 @@
  */
 
 struct pv_entry {                      /* locked by its list's pvh_lock */
-       SPLAY_ENTRY(pv_entry) pv_next;  /* next entry */
+       SPLAY_ENTRY(pv_entry) pv_node;  /* splay-tree node */
        struct pmap *pv_pmap;           /* the pmap */
        vaddr_t pv_va;                  /* the virtual address */
        struct vm_page *pv_ptp;         /* the vm_page of the PTP */
diff -r c42718f8b265 -r 3d53dfb4a5ed sys/arch/i386/include/vmparam.h
--- a/sys/arch/i386/include/vmparam.h   Thu Oct 23 07:49:35 2003 +0000
+++ b/sys/arch/i386/include/vmparam.h   Thu Oct 23 08:30:21 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vmparam.h,v 1.55 2003/10/23 03:03:20 provos Exp $      */
+/*     $NetBSD: vmparam.h,v 1.56 2003/10/23 08:30:21 chs Exp $ */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -140,13 +140,14 @@
 #define        VM_MDPAGE_INIT(pg)                                      \
        memset(&(pg)->mdpage, 0, sizeof((pg)->mdpage));         \
        simple_lock_init(&(pg)->mdpage.mp_pvhead.pvh_lock);     \
+       SPLAY_INIT(&(pg)->mdpage.mp_pvhead.pvh_root);
 
 struct pv_entry;
 
 struct pv_head {
-       struct simplelock pvh_lock;     /* locks every pv on this list */
+       struct simplelock pvh_lock;     /* locks every pv in this tree */
        SPLAY_HEAD(pvtree, pv_entry) pvh_root;
-                                       /* head of list (locked by pvh_lock) */
+                                       /* head of tree (locked by pvh_lock) */
 };
 
 struct vm_page_md {



Home | Main Index | Thread Index | Old Index