Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Apr 2002 19:44:24 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 9484 for review
Message-ID:  <200204100244.g3A2iOv25021@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=9484

Change 9484 by jhb@jhb_laptop on 2002/04/09 19:43:53

	Tidy up sched locking.

Affected files ...

... //depot/projects/smpng/sys/kern/kern_sig.c#28 edit

Differences ...

==== //depot/projects/smpng/sys/kern/kern_sig.c#28 (text+ko) ====

@@ -1040,13 +1040,10 @@
 				PROC_UNLOCK(p);
 				continue;
 			}
-			mtx_lock_spin(&sched_lock);
 			if (p->p_stat == SZOMB) {
-				mtx_unlock_spin(&sched_lock);
 				PROC_UNLOCK(p);
 				continue;
 			}
-			mtx_unlock_spin(&sched_lock);
 			if (p_cansignal(cp, p, sig) == 0) {
 				nfound++;
 				if (sig)
@@ -1333,6 +1330,10 @@
 	 * Defer further processing for signals which are held,
 	 * except that stopped processes must be continued by SIGCONT.
 	 */
+	/*
+	 * XXX: we shouldn't drop sched_lock from signotify() and then lock it
+	 * again here.
+	 */
 	mtx_lock_spin(&sched_lock);
 	if (action == SIG_HOLD && (!(prop & SA_CONT) || p->p_stat != SSTOP)) {
 		mtx_unlock_spin(&sched_lock);
@@ -1352,6 +1353,7 @@
 			mtx_unlock_spin(&sched_lock);
 			goto out;
 		}
+		mtx_unlock_spin(&sched_lock);
 		/*
 		 * Process is sleeping and traced... make it runnable
 		 * so it can discover the signal in issignal() and stop
@@ -1359,7 +1361,6 @@
 		 */
 		if (p->p_flag & P_TRACED)
 			goto run;
-		mtx_unlock_spin(&sched_lock);
 		/*
 		 * If SIGCONT is default (or ignored) and process is
 		 * asleep, we are finished; the process should not
@@ -1443,13 +1444,12 @@
 						/* mark it as sleeping */
 					}
 				}
-				mtx_unlock_spin(&sched_lock);
 			} else {
 				if (td->td_wchan == NULL)
 					goto run;
 				p->p_stat = SSLEEP;
-				mtx_unlock_spin(&sched_lock);
 			}
+			mtx_unlock_spin(&sched_lock);
 			goto out;
 		}
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204100244.g3A2iOv25021>