summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2005-08-19 11:51:41 +0000
committerdavidxu <davidxu@FreeBSD.org>2005-08-19 11:51:41 +0000
commitfae38f55581d8d132cabbdfdafff65fefc131798 (patch)
treeb85b416f7dc8b3bd72ec60e197e75ee3d2cf85f3
parent341f5fabba6d7e4bd7a1ec83ee34414e567db27b (diff)
downloadFreeBSD-src-fae38f55581d8d132cabbdfdafff65fefc131798.zip
FreeBSD-src-fae38f55581d8d132cabbdfdafff65fefc131798.tar.gz
Move up code for testing KEF_HOLD to avoid ke_cpu being changed unexpectly
for PRI_ITHD and PRI_REALTIME threads.
-rw-r--r--sys/kern/sched_ule.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 233890f..1eb302e 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -1778,6 +1778,14 @@ sched_add(struct thread *td, int flags)
return;
}
canmigrate = KSE_CAN_MIGRATE(ke);
+ /*
+ * Don't migrate running threads here. Force the long term balancer
+ * to do it.
+ */
+ if (ke->ke_flags & KEF_HOLD) {
+ ke->ke_flags &= ~KEF_HOLD;
+ canmigrate = 0;
+ }
#endif
KASSERT(ke->ke_state != KES_ONRUNQ,
("sched_add: kse %p (%s) already in run queue", ke,
@@ -1818,14 +1826,6 @@ sched_add(struct thread *td, int flags)
}
#ifdef SMP
/*
- * Don't migrate running threads here. Force the long term balancer
- * to do it.
- */
- if (ke->ke_flags & KEF_HOLD) {
- ke->ke_flags &= ~KEF_HOLD;
- canmigrate = 0;
- }
- /*
* If this thread is pinned or bound, notify the target cpu.
*/
if (!canmigrate && ke->ke_cpu != PCPU_GET(cpuid) ) {
OpenPOWER on IntegriCloud