dtrace sched:::preempt should fire only when there is preemption

The probe fire on any thread switch before.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	Panzura
This commit is contained in:
avg 2017-03-25 19:08:51 +00:00
parent 04ec8ce247
commit 9b9e5a69c6

View File

@ -430,7 +430,11 @@ mi_switch(int flags, struct thread *newtd)
PCPU_SET(switchticks, ticks); PCPU_SET(switchticks, ticks);
CTR4(KTR_PROC, "mi_switch: old thread %ld (td_sched %p, pid %ld, %s)", CTR4(KTR_PROC, "mi_switch: old thread %ld (td_sched %p, pid %ld, %s)",
td->td_tid, td_get_sched(td), td->td_proc->p_pid, td->td_name); td->td_tid, td_get_sched(td), td->td_proc->p_pid, td->td_name);
SDT_PROBE0(sched, , , preempt); #ifdef KDTRACE_HOOKS
if ((flags & SW_PREEMPT) != 0 || ((flags & SW_INVOL) != 0 &&
(flags & SW_TYPE_MASK) == SWT_NEEDRESCHED))
SDT_PROBE0(sched, , , preempt);
#endif
sched_switch(td, newtd, flags); sched_switch(td, newtd, flags);
CTR4(KTR_PROC, "mi_switch: new thread %ld (td_sched %p, pid %ld, %s)", CTR4(KTR_PROC, "mi_switch: new thread %ld (td_sched %p, pid %ld, %s)",
td->td_tid, td_get_sched(td), td->td_proc->p_pid, td->td_name); td->td_tid, td_get_sched(td), td->td_proc->p_pid, td->td_name);