PERFORCE change 61374 for review

Julian Elischer julian at FreeBSD.org
Sat Sep 11 22:47:38 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=61374

Change 61374 by julian at julian_ref on 2004/09/12 05:46:49

	A hackish fix for preemption and threads,

Affected files ...

.. //depot/projects/nsched/sys/kern/kern_switch.c#22 edit
.. //depot/projects/nsched/sys/kern/sched_4bsd.c#49 edit
.. //depot/projects/nsched/sys/kern/sched_ule.c#31 edit
.. //depot/projects/nsched/sys/sys/proc.h#30 edit

Differences ...

==== //depot/projects/nsched/sys/kern/kern_switch.c#22 (text+ko) ====

@@ -396,6 +396,10 @@
 		return;
 	}
 
+	if (((flags & (SRQ_YIELDING|SRQ_OURSELF|SRQ_NOPREEMPT)) == 0) &&
+	    maybe_preempt(td))
+		return;
+
 	CHECKRUNQ(kg, td)
 	tda = kg->kg_last_assigned;
 	if ((kg->kg_avail_opennings <= 0) &&
@@ -453,7 +457,7 @@
 			kg->kg_last_assigned = td2;
 		}
 		kg->kg_avail_opennings--;
-		sched_add(td2, flags);
+		sched_add(td2, flags|SRQ_NOPREEMPT);
 	} else {
 		CTR3(KTR_RUNQ, "setrunqueue: held: td%p kg%p pid%d",
 			td, td->td_ksegrp, td->td_proc->p_pid);

==== //depot/projects/nsched/sys/kern/sched_4bsd.c#49 (text+ko) ====

@@ -1018,7 +1018,8 @@
 #endif
 
 		{
-			if (maybe_preempt(td))
+			if (((flags & SRQ_NOPREEMPT) == 0) &&
+			    maybe_preempt(td))
 				return;
 		}
 	}

==== //depot/projects/nsched/sys/kern/sched_ule.c#31 (text+ko) ====

@@ -1662,13 +1662,13 @@
 
 	/* let jeff work out how to map the flags better */
 	/* I'm open to suggestions */
-	if (flags & SRQ_YIELDING)
+	if (flags & (SRQ_YIELDING|SRQ_NOPREEMPT)) {
 		/*
 		 * Preempting during switching can be bad JUJU
 		 * especially for KSE processes
 		 */
 		sched_add_internal(td, 0);
-	else
+	} else 
 		sched_add_internal(td, 1);
 }
 

==== //depot/projects/nsched/sys/sys/proc.h#30 (text+ko) ====

@@ -658,6 +658,7 @@
 #define SRQ_YIELDING	0x0001		/* we are yielding (from mi_switch) */
 #define SRQ_OURSELF	0x0002		/* it is ourself (from mi_switch) */
 #define SRQ_INTR	0x0004		/* it is probably urgent */
+#define SRQ_NOPREEMPT	0x0008		/* Just don't ok? */
 
 /* How values for thread_single(). */
 #define	SINGLE_NO_EXIT	0


More information about the p4-projects mailing list