kernel - Disable lwp->lwp optimization in thread switcher
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 26 Jul 2016 23:24:14 +0000 (16:24 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 27 Jul 2016 00:21:41 +0000 (17:21 -0700)
commit38d8acb8eea2ddd5388322d3ef399687299f727d
treebe889145bac01739968143666dfe6b61a95b4f9b
parent05596e13557ca5d3dbed7086330b2d710e7f0612
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.
sys/platform/pc64/x86_64/swtch.s