Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/kern Pullup rev. 1.97 via patch (approved by thorpe...



details:   https://anonhg.NetBSD.org/src/rev/eb9030a7459c
branches:  netbsd-1-5
changeset: 489534:eb9030a7459c
user:      enami <enami%NetBSD.org@localhost>
date:      Tue Sep 26 02:07:17 2000 +0000

description:
Pullup rev. 1.97 via patch (approved by thorpej%netbsd.org@localhost):
Stop runnable but swapped out user processes also in suspendsched().

diffstat:

 sys/kern/kern_synch.c |  50 ++++++++++++++++++++++++--------------------------
 1 files changed, 24 insertions(+), 26 deletions(-)

diffs (70 lines):

diff -r acffd1fc70fd -r eb9030a7459c sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c     Tue Sep 26 00:35:02 2000 +0000
+++ b/sys/kern/kern_synch.c     Tue Sep 26 02:07:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_synch.c,v 1.78.2.4 2000/09/19 18:02:04 thorpej Exp $      */
+/*     $NetBSD: kern_synch.c,v 1.78.2.5 2000/09/26 02:07:17 enami Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -964,37 +964,35 @@
 void
 suspendsched()
 {
-       struct proc *p, *next;
-       int s, i;
-       
+       struct proc *p;
+       int s;
+
        /*
-        * Convert all non-P_SYSTEM SSLEEP processes to SSTOP. Curproc is
-        * necesserelly SONPROC.
+        * Convert all non-P_SYSTEM SSLEEP or SRUN processes to SSTOP.
         */
        proclist_lock_read();
        s = splclock();
-       for (p = LIST_FIRST(&allproc); p != NULL; p = next) {
-               next = LIST_NEXT(p, p_list);
-               if (p->p_stat != SSLEEP || p == curproc ||
-                   (p->p_flag & P_SYSTEM) != 0)
+       for (p = LIST_FIRST(&allproc); p != NULL; p = LIST_NEXT(p, p_list)) {
+               if ((p->p_flag & P_SYSTEM) != 0)
                        continue;
-               p->p_stat = SSTOP;
-       }
-       proclist_unlock_read();
-
-       /* go through the run queues, remove non-P_SYSTEM processes */
-       for (i = 0; i < RUNQUE_NQS; i++) {
-               for (p = sched_qs[i].ph_link;
-                   p != (struct proc *)&sched_qs[i]; p = next) {
-                       next = p->p_forw;
-                       if ((p->p_flag & P_SYSTEM) == 0) {
-                               if (p->p_flag & P_INMEM)
-                                       remrunqueue(p);
-                               p->p_stat = SSTOP;
-                       }
+               switch (p->p_stat) {
+               case SRUN:
+                       if ((p->p_flag & P_INMEM) != 0)
+                               remrunqueue(p);
+                       /* FALLTHROUGH */
+               case SSLEEP:
+                       p->p_stat = SSTOP;
+                       break;
+               case SONPROC:
+                       /*
+                        * XXX SMP: we need to deal with processes on
+                        * others CPU !
+                        */
+                       break;
+               default:
+                       break;
                }
        }
-       /* XXX SMP: we need to deal with processes on others CPU ! */
-
        splx(s);
+       proclist_unlock_read();
 }



Home | Main Index | Thread Index | Old Index