kernel - Disable lwp->lwp optimization in thread switcher
* Put #ifdef around the existing lwp->lwp switch optimization and then
disable it. This optimizations tries to avoid reloading %cr3 and avoid
pmap->pm_active atomic ops when switching to a lwp that shares the same
process.
This optimization is no longer applicable on multi-core systems as such
switches are very rare. LWPs are usually distributed across multiple cores
so rarely does one switch to another on the same core (and in cpu-bound
situations, the scheduler will already be in batch mode). The conditionals
in the optimization, on the other hand, did measurably (just slightly)
reduce performance for normal switches. So turn it off.
* Implement an optimization for interrupt preemptions, but disable it for
now. I want to keep the code handy but so far my tests show no improvement
in performance with huge interrupt rates (from nvme devices), so it is
#undef'd for now.