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 Pull up fixes to suspendsched():



details:   https://anonhg.NetBSD.org/src/rev/a2aca4e00647
branches:  netbsd-1-5
changeset: 489476:a2aca4e00647
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Sep 19 18:02:04 2000 +0000

description:
Pull up fixes to suspendsched():

revision 1.95
date: 2000/09/14 19:13:29;  author: thorpej;  state: Exp;  lines: +7 -5
Make sure to lock the proclist when we're traversing allproc.

revision 1.96
date: 2000/09/15 06:36:25;  author: enami;  state: Exp;  lines: +4 -4
The struct prochd isn't a proc.  Start scaning from prochd.ph_link instead
of &prochd.

diffstat:

 sys/kern/kern_synch.c |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (43 lines):

diff -r ed597d6929ae -r a2aca4e00647 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c     Tue Sep 19 17:48:54 2000 +0000
+++ b/sys/kern/kern_synch.c     Tue Sep 19 18:02:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_synch.c,v 1.78.2.3 2000/09/06 08:41:42 bouyer Exp $       */
+/*     $NetBSD: kern_synch.c,v 1.78.2.4 2000/09/19 18:02:04 thorpej Exp $      */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -964,15 +964,15 @@
 void
 suspendsched()
 {
+       struct proc *p, *next;
        int s, i;
-       struct proc *p, *next;
        
-       s = splclock();
-
        /*
         * Convert all non-P_SYSTEM SSLEEP processes to SSTOP. Curproc is
         * necesserelly SONPROC.
         */
+       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 ||
@@ -980,10 +980,12 @@
                        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 = (struct proc *)&sched_qs[i];
-                   p->p_forw != (struct proc *)&sched_qs[i]; p = next) {
+               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)



Home | Main Index | Thread Index | Old Index