Source-Changes-HG archive

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

[src/trunk]: src/sys Garbage collect thread_sleep()/thread_wakeup() left over...



details:   https://anonhg.NetBSD.org/src/rev/6b0a353eb936
branches:  trunk
changeset: 474852:6b0a353eb936
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jul 22 22:58:38 1999 +0000

description:
Garbage collect thread_sleep()/thread_wakeup() left over from the old
Mach VM code.  Also nuke iprintf(), which was no longer used anywhere.

Add proclist locking where appropriate.

diffstat:

 sys/conf/files        |   3 +--
 sys/uvm/uvm.h         |  12 ++++++------
 sys/uvm/uvm_aobj.c    |   4 ++--
 sys/uvm/uvm_extern.h  |   5 ++++-
 sys/uvm/uvm_fault.c   |  16 ++++++++--------
 sys/uvm/uvm_glue.c    |  31 ++++++++++++++++++++++++++++++-
 sys/uvm/uvm_km.c      |   4 ++--
 sys/uvm/uvm_loan.c    |  12 ++++++------
 sys/uvm/uvm_meter.c   |   6 +++++-
 sys/uvm/uvm_page.c    |   4 ++--
 sys/uvm/uvm_pager.c   |   4 ++--
 sys/uvm/uvm_pdaemon.c |   8 ++++----
 sys/uvm/uvm_pglist.c  |   4 ++--
 sys/uvm/uvm_swap.c    |   4 ++--
 sys/uvm/uvm_vnode.c   |   6 +++---
 sys/vm/vm_extern.h    |  14 +-------------
 sys/vm/vm_page.h      |   4 ++--
 17 files changed, 82 insertions(+), 59 deletions(-)

diffs (truncated from 531 to 300 lines):

diff -r 115c8301f117 -r 6b0a353eb936 sys/conf/files
--- a/sys/conf/files    Thu Jul 22 22:44:42 1999 +0000
+++ b/sys/conf/files    Thu Jul 22 22:58:38 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files,v 1.302 1999/07/09 23:41:16 thorpej Exp $
+#      $NetBSD: files,v 1.303 1999/07/22 22:58:40 thorpej Exp $
 
 #      @(#)files.newconf       7.5 (Berkeley) 5/10/93
 
@@ -601,7 +601,6 @@
 file kern/kern_exec.c
 file kern/kern_exit.c
 file kern/kern_fork.c
-file kern/kern_fthread.c
 file kern/kern_kthread.c
 file kern/kern_ktrace.c                        ktrace
 file kern/kern_lkm.c                   lkm
diff -r 115c8301f117 -r 6b0a353eb936 sys/uvm/uvm.h
--- a/sys/uvm/uvm.h     Thu Jul 22 22:44:42 1999 +0000
+++ b/sys/uvm/uvm.h     Thu Jul 22 22:58:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm.h,v 1.16 1999/06/21 17:25:11 thorpej Exp $ */
+/*     $NetBSD: uvm.h,v 1.17 1999/07/22 22:58:38 thorpej Exp $ */
 
 /*
  *
@@ -148,16 +148,16 @@
 
 /*
  * UVM_UNLOCK_AND_WAIT: atomic unlock+wait... front end for the 
- * (poorly named) thread_sleep_msg function.
+ * uvm_sleep() function.
  */
 
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
-#define UVM_UNLOCK_AND_WAIT(event,lock,intr,msg, timo) \
-       thread_sleep_msg(event,lock,intr,msg, timo)
+#define UVM_UNLOCK_AND_WAIT(event, lock, intr ,msg, timo) \
+       uvm_sleep(event, lock, intr, msg, timo)
 
 #else
-#define UVM_UNLOCK_AND_WAIT(event,lock,intr,msg, timo) \
-       thread_sleep_msg(event,NULL,intr,msg, timo)
+#define UVM_UNLOCK_AND_WAIT(event, lock, intr, msg, timo) \
+       uvm_sleep(event, NULL, intr, msg, timo)
 #endif /* MULTIPROCESSOR || LOCKDEBUG */
 
 /*
diff -r 115c8301f117 -r 6b0a353eb936 sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c        Thu Jul 22 22:44:42 1999 +0000
+++ b/sys/uvm/uvm_aobj.c        Thu Jul 22 22:58:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_aobj.c,v 1.23 1999/07/22 21:27:32 thorpej Exp $    */
+/*     $NetBSD: uvm_aobj.c,v 1.24 1999/07/22 22:58:38 thorpej Exp $    */
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -1165,7 +1165,7 @@
                                    rv,0,0,0);
                                if (ptmp->flags & PG_WANTED)
                                        /* object lock still held */
-                                       thread_wakeup(ptmp);
+                                       wakeup(ptmp);
                                ptmp->flags &= ~(PG_WANTED|PG_BUSY);
                                UVM_PAGE_OWN(ptmp, NULL);
                                uvm_lock_pageq();
diff -r 115c8301f117 -r 6b0a353eb936 sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h      Thu Jul 22 22:44:42 1999 +0000
+++ b/sys/uvm/uvm_extern.h      Thu Jul 22 22:58:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_extern.h,v 1.33 1999/07/17 21:35:49 thorpej Exp $  */
+/*     $NetBSD: uvm_extern.h,v 1.34 1999/07/22 22:58:38 thorpej Exp $  */
 
 /*
  *
@@ -155,6 +155,7 @@
 struct vmspace;
 struct pmap;
 struct vnode;
+struct simplelock;
 
 /*
  * uvmexp: global data structures that are exported to parts of the kernel
@@ -287,6 +288,8 @@
 #if defined(KGDB)
 void                   uvm_chgkprot __P((caddr_t, size_t, int));
 #endif
+void                   uvm_sleep __P((void *, struct simplelock *, boolean_t,
+                           const char *, int));
 void                   uvm_fork __P((struct proc *, struct proc *, boolean_t,
                            void *, size_t));
 void                   uvm_exit __P((struct proc *));
diff -r 115c8301f117 -r 6b0a353eb936 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Thu Jul 22 22:44:42 1999 +0000
+++ b/sys/uvm/uvm_fault.c       Thu Jul 22 22:58:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.43 1999/07/19 19:02:22 cgd Exp $       */
+/*     $NetBSD: uvm_fault.c,v 1.44 1999/07/22 22:58:38 thorpej Exp $   */
 
 /*
  *
@@ -437,7 +437,7 @@
 
                        if (pg->flags & PG_WANTED) {
                                /* still holding object lock */
-                               thread_wakeup(pg);      
+                               wakeup(pg);     
                        }
                        /* un-busy! */
                        pg->flags &= ~(PG_WANTED|PG_BUSY|PG_FAKE);
@@ -1383,7 +1383,7 @@
                            0,0,0,0);
                        if (uobjpage->flags & PG_WANTED)
                                /* still holding object lock */
-                               thread_wakeup(uobjpage);
+                               wakeup(uobjpage);
 
                        if (uobjpage->flags & PG_RELEASED) {
                                uvmexp.fltpgrele++;
@@ -1473,7 +1473,7 @@
                                         * be released
                                         * */
                                        if (uobjpage->flags & PG_WANTED)
-                                               thread_wakeup(uobjpage);
+                                               wakeup(uobjpage);
                                        uobjpage->flags &= ~(PG_BUSY|PG_WANTED);
                                        UVM_PAGE_OWN(uobjpage, NULL);
 
@@ -1505,7 +1505,7 @@
                                pmap_page_protect(PMAP_PGARG(uobjpage),
                                    VM_PROT_NONE); 
                                if (uobjpage->flags & PG_WANTED)
-                                       thread_wakeup(uobjpage);
+                                       wakeup(uobjpage);
                                /* uobj still locked */
                                uobjpage->flags &= ~(PG_WANTED|PG_BUSY);
                                UVM_PAGE_OWN(uobjpage, NULL);
@@ -1563,7 +1563,7 @@
                        if (uobjpage != PGO_DONTCARE) {
                                if (uobjpage->flags & PG_WANTED)
                                        /* still holding object lock */
-                                       thread_wakeup(uobjpage);
+                                       wakeup(uobjpage);
 
                                uvm_lock_pageq();
                                /* make sure it is in queues */
@@ -1622,7 +1622,7 @@
 
                        if (uobjpage->flags & PG_WANTED)
                                /* still have the obj lock */
-                               thread_wakeup(uobjpage);
+                               wakeup(uobjpage);
                        uobjpage->flags &= ~(PG_BUSY|PG_WANTED);
                        UVM_PAGE_OWN(uobjpage, NULL);
                        uvm_lock_pageq();
@@ -1688,7 +1688,7 @@
        uvm_unlock_pageq();
 
        if (pg->flags & PG_WANTED)
-               thread_wakeup(pg);              /* lock still held */
+               wakeup(pg);             /* lock still held */
 
        /* 
         * note that pg can't be PG_RELEASED since we did not drop the object 
diff -r 115c8301f117 -r 6b0a353eb936 sys/uvm/uvm_glue.c
--- a/sys/uvm/uvm_glue.c        Thu Jul 22 22:44:42 1999 +0000
+++ b/sys/uvm/uvm_glue.c        Thu Jul 22 22:58:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_glue.c,v 1.27 1999/07/08 18:11:03 thorpej Exp $    */
+/*     $NetBSD: uvm_glue.c,v 1.28 1999/07/22 22:58:38 thorpej Exp $    */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -109,6 +109,31 @@
 
 
 /*
+ * uvm_sleep: atomic unlock and sleep for UVM_UNLOCK_AND_WAIT().
+ */
+
+void
+uvm_sleep(event, slock, canintr, msg, timo)
+       void *event;
+       struct simplelock *slock;
+       boolean_t canintr;
+       const char *msg;
+       int timo;
+{
+       int s, pri;
+
+       pri = PVM;
+       if (canintr)
+               pri |= PCATCH;
+
+       s = splhigh();
+       if (slock != NULL)
+               simple_unlock(slock);
+       (void) tsleep(event, pri, msg, timo);
+       splx(s);
+}
+
+/*
  * uvm_kernacc: can the kernel access a region of memory
  *
  * - called from malloc [DIAGNOSTIC], and /dev/kmem driver (mem.c)
@@ -422,6 +447,7 @@
 #endif
        pp = NULL;              /* process to choose */
        ppri = INT_MIN; /* its priority */
+       proclist_lock_read(0);
        for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
 
                /* is it a runnable swapped out process? */
@@ -434,6 +460,7 @@
                        }
                }
        }
+       proclist_unlock_read();
 
 #ifdef DEBUG
        if (swapdebug & SDB_FOLLOW)
@@ -521,6 +548,7 @@
         */
        outp = outp2 = NULL;
        outpri = outpri2 = 0;
+       proclist_lock_read(0);
        for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
                if (!swappable(p))
                        continue;
@@ -544,6 +572,7 @@
                        continue;
                }
        }
+       proclist_unlock_read();
 
        /*
         * If we didn't get rid of any real duds, toss out the next most
diff -r 115c8301f117 -r 6b0a353eb936 sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c  Thu Jul 22 22:44:42 1999 +0000
+++ b/sys/uvm/uvm_km.c  Thu Jul 22 22:58:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_km.c,v 1.30 1999/07/22 21:27:32 thorpej Exp $      */
+/*     $NetBSD: uvm_km.c,v 1.31 1999/07/22 22:58:38 thorpej Exp $      */
 
 /* 
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -655,7 +655,7 @@
        vm_map_lock(map);
        (void)uvm_unmap_remove(map, trunc_page(addr), round_page(addr+size), 
                         &dead_entries);
-       thread_wakeup(map);
+       wakeup(map);
        vm_map_unlock(map);
 
        if (dead_entries != NULL)
diff -r 115c8301f117 -r 6b0a353eb936 sys/uvm/uvm_loan.c
--- a/sys/uvm/uvm_loan.c        Thu Jul 22 22:44:42 1999 +0000
+++ b/sys/uvm/uvm_loan.c        Thu Jul 22 22:58:38 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_loan.c,v 1.17 1999/06/03 00:05:45 thorpej Exp $    */
+/*     $NetBSD: uvm_loan.c,v 1.18 1999/07/22 22:58:38 thorpej Exp $    */
 
 /*
  *
@@ -500,7 +500,7 @@
 
                        if (pg->flags & PG_WANTED)
                                /* still holding object lock */
-                               thread_wakeup(pg);
+                               wakeup(pg);
 
                        if (pg->flags & PG_RELEASED) {
 #ifdef DIAGNOSTIC
@@ -539,7 +539,7 @@
                **output = pg;
                *output = (*output) + 1;
                if (pg->flags & PG_WANTED)
-                       thread_wakeup(pg);
+                       wakeup(pg);
                pg->flags &= ~(PG_WANTED|PG_BUSY);
                UVM_PAGE_OWN(pg, NULL);
                return(1);              /* got it! */
@@ -563,7 +563,7 @@
                uvm_pageactivate(pg);   /* reactivate */
                uvm_unlock_pageq();
                if (pg->flags & PG_WANTED)
-                       thread_wakeup(pg);
+                       wakeup(pg);
                pg->flags &= ~(PG_WANTED|PG_BUSY);
                UVM_PAGE_OWN(pg, NULL);
                return(1);
@@ -576,7 +576,7 @@
        anon = uvm_analloc();
        if (anon == NULL) {             /* out of VM! */
                if (pg->flags & PG_WANTED)
-                       thread_wakeup(pg);
+                       wakeup(pg);
                pg->flags &= ~(PG_WANTED|PG_BUSY);
                UVM_PAGE_OWN(pg, NULL);
                uvmfault_unlockall(ufi, amap, uobj, NULL);



Home | Main Index | Thread Index | Old Index