diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index ab2f12957ec1..4ac211df140c 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -418,6 +418,8 @@ statclock(frame) cp_time[CP_IDLE]++; } } + CTR4(KTR_SCHED, "statclock: %p(%s) prio %d stathz %d", + td, td->td_proc->p_comm, td->td_priority, (stathz)?stathz:hz); sched_clock(td); diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 3177f72edddb..c59af8b53b5e 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -456,6 +456,9 @@ setrunqueue(struct thread *td, int flags) CTR3(KTR_RUNQ, "setrunqueue: td:%p kg:%p pid:%d", td, td->td_ksegrp, td->td_proc->p_pid); + CTR5(KTR_SCHED, "setrunqueue: %p(%s) prio %d by %p(%s)", + td, td->td_proc->p_comm, td->td_priority, curthread, + curthread->td_proc->p_comm); mtx_assert(&sched_lock, MA_OWNED); KASSERT((td->td_inhibitors == 0), ("setrunqueue: trying to run inhibitted thread")); diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index b6968bf33d36..bd28c1de0b76 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -340,7 +340,24 @@ mi_switch(int flags, struct thread *newtd) (void *)td, td->td_sched, (long)p->p_pid, p->p_comm); if ((flags & SW_VOL) && (td->td_proc->p_flag & P_SA)) newtd = thread_switchout(td, flags, newtd); +#if (KTR_COMPILE & KTR_SCHED) != 0 + if (td == PCPU_GET(idlethread)) + CTR3(KTR_SCHED, "mi_switch: %p(%s) prio %d idle", + td, td->td_proc->p_comm, td->td_priority); + else if (newtd != NULL) + CTR5(KTR_SCHED, + "mi_switch: %p(%s) prio %d preempted by %p(%s)", + td, td->td_proc->p_comm, td->td_priority, newtd, + newtd->td_proc->p_comm); + else + CTR6(KTR_SCHED, + "mi_switch: %p(%s) prio %d inhibit %d wmesg %s lock %s", + td, td->td_proc->p_comm, td->td_priority, + td->td_inhibitors, td->td_wmesg, td->td_lockname); +#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); CTR4(KTR_PROC, "mi_switch: new thread %p (kse %p, pid %ld, %s)", (void *)td, td->td_sched, (long)p->p_pid, p->p_comm);