summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2007-01-03 02:38:41 +0000
committerjeff <jeff@FreeBSD.org>2007-01-03 02:38:41 +0000
commitb5c5ce5407f0f7e04791fd5b2556e47f7432484e (patch)
treef2d5c81815a5fdea1c671013f4a3e5e1c117b0f5 /sys/kern/kern_synch.c
parentce3f20a6a33c048d3e9c30fe67f47b7c7d64f49c (diff)
downloadFreeBSD-src-b5c5ce5407f0f7e04791fd5b2556e47f7432484e.zip
FreeBSD-src-b5c5ce5407f0f7e04791fd5b2556e47f7432484e.tar.gz
- Fix schedgraph output with KSE threads. Call thread_switchout() after
calling CTR() so we don't confuse a new kse thread with a real preemption.
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 27fd835..6cc7c70 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -407,10 +407,6 @@ mi_switch(int flags, struct thread *newtd)
PCPU_SET(switchticks, ticks);
CTR4(KTR_PROC, "mi_switch: old thread %p (kse %p, pid %ld, %s)",
(void *)td, td->td_sched, (long)p->p_pid, p->p_comm);
-#ifdef KSE
- if ((flags & SW_VOL) && (td->td_proc->p_flag & P_SA))
- newtd = thread_switchout(td, flags, newtd);
-#endif
#if (KTR_COMPILE & KTR_SCHED) != 0
if (td == PCPU_GET(idlethread))
CTR3(KTR_SCHED, "mi_switch: %p(%s) prio %d idle",
@@ -426,6 +422,14 @@ mi_switch(int flags, struct thread *newtd)
td, td->td_proc->p_comm, td->td_priority,
td->td_inhibitors, td->td_wmesg, td->td_lockname);
#endif
+ /*
+ * We call thread_switchout after the KTR_SCHED prints above so kse
+ * selecting a new thread to run does not show up as a preemption.
+ */
+#ifdef KSE
+ if ((flags & SW_VOL) && (td->td_proc->p_flag & P_SA))
+ newtd = thread_switchout(td, flags, newtd);
+#endif
sched_switch(td, newtd, flags);
CTR3(KTR_SCHED, "mi_switch: running %p(%s) prio %d",
td, td->td_proc->p_comm, td->td_priority);
OpenPOWER on IntegriCloud