PERFORCE change 103206 for review

John Birrell jb at FreeBSD.org
Fri Aug 4 22:32:52 UTC 2006


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

Change 103206 by jb at jb_freebsd2 on 2006/08/04 22:32:24

	Merge KSE support back in, but only if the KSE kernel option is defined.

Affected files ...

.. //depot/projects/dtrace/src/sys/vm/vm_glue.c#4 edit

Differences ...

==== //depot/projects/dtrace/src/sys/vm/vm_glue.c#4 (text+ko) ====

@@ -682,8 +682,12 @@
 	ppri = INT_MIN;
 	sx_slock(&allproc_lock);
 	FOREACH_PROC_IN_SYSTEM(p) {
-		if (p->p_sflag & (PS_INMEM | PS_SWAPPINGOUT | PS_SWAPPINGIN))
+#ifdef KSE
+		struct ksegrp *kg;
+#endif
+		if (p->p_sflag & (PS_INMEM | PS_SWAPPINGOUT | PS_SWAPPINGIN)) {
 			continue;
+		}
 		mtx_lock_spin(&sched_lock);
 		FOREACH_THREAD_IN_PROC(p, td) {
 			/*
@@ -692,13 +696,18 @@
 			 * 
 			 */
 			if (td->td_inhibitors == TDI_SWAPPED) {
+#ifdef KSE
+				kg = td->td_ksegrp;
+				pri = p->p_swtime + kg->kg_slptime;
+#else
 				pri = p->p_swtime + td->td_slptime;
+#endif
 				if ((p->p_sflag & PS_SWAPINREQ) == 0) {
 					pri -= p->p_nice * 8;
 				}
 
 				/*
-				 * if this thread is higher priority
+				 * if this ksegrp/thread is higher priority
 				 * and there is enough space, then select
 				 * this process instead of the previous
 				 * selection.
@@ -807,6 +816,9 @@
 {
 	struct proc *p;
 	struct thread *td;
+#ifdef KSE
+	struct ksegrp *kg;
+#endif
 	int didswap = 0;
 
 retry:
@@ -880,15 +892,24 @@
 			 * do not swapout a realtime process
 			 * Check all the thread groups..
 			 */
+#ifdef KSE
+			FOREACH_KSEGRP_IN_PROC(p, kg) {
+				if (PRI_IS_REALTIME(kg->kg_pri_class))
+#else
 			FOREACH_THREAD_IN_PROC(p, td) {
 				if (PRI_IS_REALTIME(td->td_pri_class))
+#endif
 					goto nextproc;
 
 				/*
 				 * Guarantee swap_idle_threshold1
 				 * time in memory.
 				 */
+#ifdef KSE
+				if (kg->kg_slptime < swap_idle_threshold1)
+#else
 				if (td->td_slptime < swap_idle_threshold1)
+#endif
 					goto nextproc;
 
 				/*
@@ -900,8 +921,16 @@
 				 * This could be refined to support
 				 * swapping out a thread.
 				 */
+#ifdef KSE
+				FOREACH_THREAD_IN_GROUP(kg, td) {
+					if ((td->td_priority) < PSOCK ||
+					    !thread_safetoswapout(td))
+						goto nextproc;
+				}
+#else
 				if ((td->td_priority) < PSOCK || !thread_safetoswapout(td))
 					goto nextproc;
+#endif
 				/*
 				 * If the system is under memory stress,
 				 * or if we are swapping
@@ -910,11 +939,20 @@
 				 */
 				if (((action & VM_SWAP_NORMAL) == 0) &&
 				    (((action & VM_SWAP_IDLE) == 0) ||
+#ifdef KSE
+				    (kg->kg_slptime < swap_idle_threshold2)))
+#else
 				    (td->td_slptime < swap_idle_threshold2)))
+#endif
 					goto nextproc;
 
+#ifdef KSE
+				if (minslptime > kg->kg_slptime)
+					minslptime = kg->kg_slptime;
+#else
 				if (minslptime > td->td_slptime)
 					minslptime = td->td_slptime;
+#endif
 			}
 
 			/*


More information about the p4-projects mailing list