I am working on reducing the diffs in my scheduler locking change branch. https://github.com/freebsd/freebsd/compare/master...jwroberson:schedlock
This is a small change that allows the direct switch optimization in sched_preempt() to work as intended. Otherwise we grab the sched lock, set owepreempt, drop the sched lock, critical_exit, acquire the sched lock, see owepreempt, then switch.