git: kernel - Disable lwp->lwp optimization in thread switcher

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Jul 26 16:28:33 PDT 2016


commit b4758707dd5c7257ed376de88139920e95589c78
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Jul 26 16:24:14 2016 -0700

    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.

Summary of changes:
 sys/platform/pc64/x86_64/swtch.s | 132 ++++++++++++++++++++++++++++++++-------
 1 file changed, 111 insertions(+), 21 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/b4758707dd5c7257ed376de88139920e95589c78


-- 
DragonFly BSD source repository



More information about the Commits mailing list