summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_glue.c
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>2006-10-26 21:42:22 +0000
committerjb <jb@FreeBSD.org>2006-10-26 21:42:22 +0000
commitf82c7997354f95e680341bb8e10136ded5fd15eb (patch)
tree2136d90e7e60f4ef25fe147499787d0e6a155b82 /sys/vm/vm_glue.c
parentb3e38fbc69f126c6cc49a0a6e45096d6c01b7c43 (diff)
downloadFreeBSD-src-f82c7997354f95e680341bb8e10136ded5fd15eb.zip
FreeBSD-src-f82c7997354f95e680341bb8e10136ded5fd15eb.tar.gz
Make KSE a kernel option, turned on by default in all GENERIC
kernel configs except sun4v (which doesn't process signals properly with KSE). Reviewed by: davidxu@
Diffstat (limited to 'sys/vm/vm_glue.c')
-rw-r--r--sys/vm/vm_glue.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index 2f90acf..de56199 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -682,7 +682,9 @@ loop:
ppri = INT_MIN;
sx_slock(&allproc_lock);
FOREACH_PROC_IN_SYSTEM(p) {
+#ifdef KSE
struct ksegrp *kg;
+#endif
if (p->p_sflag & (PS_INMEM | PS_SWAPPINGOUT | PS_SWAPPINGIN)) {
continue;
}
@@ -694,14 +696,18 @@ loop:
*
*/
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 ksegrp is higher priority
+ * if this ksegrp/thread is higher priority
* and there is enough space, then select
* this process instead of the previous
* selection.
@@ -810,7 +816,9 @@ int action;
{
struct proc *p;
struct thread *td;
+#ifdef KSE
struct ksegrp *kg;
+#endif
int didswap = 0;
retry:
@@ -884,15 +892,24 @@ retry:
* 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;
/*
@@ -904,11 +921,16 @@ retry:
* 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
@@ -917,11 +939,20 @@ retry:
*/
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
}
/*
OpenPOWER on IntegriCloud