Source-Changes-HG archive

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

[src/nathanw_sa]: src/sys/arch/vax/vax LWPify pmap_rmproc(). The comment say...



details:   https://anonhg.NetBSD.org/src/rev/541ebdfa4a0c
branches:  nathanw_sa
changeset: 506297:541ebdfa4a0c
user:      gmcgarry <gmcgarry%NetBSD.org@localhost>
date:      Sat Oct 05 07:28:48 2002 +0000

description:
LWPify pmap_rmproc().  The comment says it is based on uvm_swapout_threads().
Brought the same LWP changes across from there.

diffstat:

 sys/arch/vax/vax/pmap.c |  55 ++++++++++++++++++++++++------------------------
 1 files changed, 28 insertions(+), 27 deletions(-)

diffs (92 lines):

diff -r 7b9d76618c30 -r 541ebdfa4a0c sys/arch/vax/vax/pmap.c
--- a/sys/arch/vax/vax/pmap.c   Sat Oct 05 07:11:56 2002 +0000
+++ b/sys/arch/vax/vax/pmap.c   Sat Oct 05 07:28:48 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.108.4.8 2002/08/27 23:46:04 nathanw Exp $      */
+/*     $NetBSD: pmap.c,v 1.108.4.9 2002/10/05 07:28:48 gmcgarry Exp $     */
 /*
  * Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -618,55 +618,56 @@
  * Avoid to remove ourselves.
  */
 
-#define swappable(p, pm)                                               \
-       (((p)->p_flag & (P_SYSTEM | P_INMEM | P_WEXIT)) == P_INMEM &&   \
-       ((p)->p_holdcnt == 0) && ((p)->p_vmspace->vm_map.pmap != pm))
+#define swappable(l, pm)                                               \
+       (((l)->l_flag & L_INMEM) == L_INMEM &&  \
+       ((l)->l_proc->p_flag & (P_SYSTEM | P_WEXIT)) == 0 &&            \
+       ((l)->l_holdcnt == 0) && ((l)->l_proc->p_vmspace->vm_map.pmap != pm))
 
 static int
 pmap_rmproc(struct pmap *pm)
 {
        struct pmap *ppm;
-       struct proc *p;
-       struct proc *outp, *outp2;
+       struct lwp *l;
+       struct lwp *outl, *outl2;
        int outpri, outpri2;
        int didswap = 0;
        extern int maxslp;
 
-       outp = outp2 = NULL;
+       outl = outl2 = NULL;
        outpri = outpri2 = 0;
        proclist_lock_read();
-       LIST_FOREACH(p, &allproc, p_list) {
-               if (!swappable(p, pm))
+       LIST_FOREACH(l, &alllwp, l_list) {
+               if (!swappable(l, pm))
                        continue;
-               ppm = p->p_vmspace->vm_map.pmap;
+               ppm = l->l_proc->p_vmspace->vm_map.pmap;
                if (ppm->pm_p0lr == 0 && ppm->pm_p1lr == NPTEPERREG)
                        continue; /* Already swapped */
-               switch (p->p_stat) {
-               case SRUN:
-               case SONPROC:
-                       if (p->p_swtime > outpri2) {
-                               outp2 = p;
-                               outpri2 = p->p_swtime;
+               switch (l->l_stat) {
+               case LSRUN:
+               case LSONPROC:
+                       if (l->l_swtime > outpri2) {
+                               outl2 = l;
+                               outpri2 = l->l_swtime;
                        }
                        continue;
-               case SSLEEP:
-               case SSTOP:
-                       if (p->p_slptime >= maxslp) {
-                               rmspace(p->p_vmspace->vm_map.pmap);
+               case LSSLEEP:
+               case LSSTOP:
+                       if (l->l_slptime >= maxslp) {
+                               rmspace(l->l_proc->p_vmspace->vm_map.pmap);
                                didswap++;
-                       } else if (p->p_slptime > outpri) {
-                               outp = p;
-                               outpri = p->p_slptime;
+                       } else if (l->l_slptime > outpri) {
+                               outl = l;
+                               outpri = l->l_slptime;
                        }
                        continue;
                }
        }
        proclist_unlock_read();
        if (didswap == 0) {
-               if ((p = outp) == NULL)
-                       p = outp2;
-               if (p) {
-                       rmspace(p->p_vmspace->vm_map.pmap);
+               if ((l = outl) == NULL)
+                       l = outl2;
+               if (l) {
+                       rmspace(l->l_proc->p_vmspace->vm_map.pmap);
                        didswap++;
                }
        }



Home | Main Index | Thread Index | Old Index