git: kernel - Reduce stalls, refactor lwkt_switch() core.

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Jul 10 14:24:18 PDT 2016


commit 5411d8f15e92c1aaa25076860bab3d3caabab347
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Jul 10 14:13:30 2016 -0700

    kernel - Reduce stalls, refactor lwkt_switch() core.
    
    * These changes primarily effect programs which have a lot of token
      contention (aka concurrent write VM faults) and exiting programs which
      have very large RSSs (e.g. multiple gigabytes).
    
    * Release proc->p_token around potentially long vmspace destruction ops.
      This avoids stalls in programs like 'ps' and functions like
      fork/exec/wait/exit.
    
    * Refactor lwkt_switch().  This may also fix a bug where we improperly
      called splz_check() after releasing the current thread's tokens.  An
      interrupt or IPI could then sneak in and corrupt a recursive token.
    
      Remove the infinite loop cycling.  When token contention is present this
      caused scheduler ticks to dock the wrong thread (the current thread instead
      of the target thread).  Heavy token contention could cause higher priority
      processes to stall for very long periods of time.
    
      Instead, once the spin limit is exhausted we switch through the idle
      thread which places us in a better context from which to continue.
    
    * Adjust the dragonfly process scheduler to detect contention when the
      current thread is the idle thread, and then attribute the tick to the
      correct thread (or at least a more-correct thread).

Summary of changes:
 sys/kern/kern_exit.c   |  15 +++
 sys/kern/lwkt_thread.c | 263 +++++++++++--------------------------------------
 sys/kern/usched_dfly.c |  41 +++++---
 3 files changed, 101 insertions(+), 218 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/5411d8f15e92c1aaa25076860bab3d3caabab347


-- 
DragonFly BSD source repository



More information about the Commits mailing list