git: kernel - Adjust the scheduler to fix nice +N glitches

Matthew Dillon dillon at crater.dragonflybsd.org
Fri Apr 27 20:50:24 PDT 2018


commit 4ae523d7b3f6e2ac118d8512afe1b6063d36d7f3
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Fri Apr 27 20:21:46 2018 -0700

    kernel - Adjust the scheduler to fix nice +N glitches
    
    * Swap the DIDYIELD and steal code.  The steal code needs to
      go first, allowing a more desirable thread to steal the uschedcp
      designation from a less desirable thread.
    
    * The DIDYIELD code also needs a need_user_resched() to interrupt the
      currently running less desirable thread.
    
    * Set a half-queue default for usched_dfly_fast_resched instead of 0.
      This should reduce unnecessary ping-ponging of user threads that
      belong to the same queue.
    
    * Increase the dynamic priority range from 12 to 20 queues.
      This ensures that a cpu-bound nice -20 process cannot completely
      override a nice +0 process, and ensures that a nice +20 process
      does not complete stall against a nice +0 cpu-bound process.
      That would be '16'.  We set it to 20 to give ourselves some headroom.
    
    * Remove some dead code.
    
    * These changes fix relative priority glitches.  More desirable
      threads no longer glitch waiting for a significantly less desirable
      thread to switch away on the current cpu, reducing the switch
      latency from 1+ scheduler ticks to a few microseconds.
    
      This allows nice +N processes and dynamic priority adjustments
      to run in the background fully cpu-bound.

Summary of changes:
 sys/kern/usched_dfly.c | 123 ++++++++++++-------------------------------------
 1 file changed, 29 insertions(+), 94 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4ae523d7b3f6e2ac118d8512afe1b6063d36d7f3


-- 
DragonFly BSD source repository


More information about the Commits mailing list