Reduce sdt-related branch-fest in mi_switch.

The code was evaluating flags before resorting to checking if dtrace is
enabled. This was inducing forward jumps in the common case.
This commit is contained in:
Mateusz Guzik 2018-05-22 08:27:33 +00:00
parent dbcdf411a1
commit 99ece3a9cd

View File

@ -431,8 +431,9 @@ mi_switch(int flags, struct thread *newtd)
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);
#ifdef KDTRACE_HOOKS
if ((flags & SW_PREEMPT) != 0 || ((flags & SW_INVOL) != 0 &&
(flags & SW_TYPE_MASK) == SWT_NEEDRESCHED))
if (__predict_false(sdt_probes_enabled) &&
((flags & SW_PREEMPT) != 0 || ((flags & SW_INVOL) != 0 &&
(flags & SW_TYPE_MASK) == SWT_NEEDRESCHED)))
SDT_PROBE0(sched, , , preempt);
#endif
sched_switch(td, newtd, flags);