DragonFly BSD
DragonFly commits List (threaded) for 2010-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

git: kernel - rewrite the LWKT scheduler's priority mechanism


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 23 Aug 2010 18:49:58 -0700 (PDT)

commit f9235b6d9cd4b6ef2a6f977a1e659de0ac635e32
Author: Matthew Dillon <dillon@apollo.backplane.com>
Date:   Mon Aug 23 18:39:45 2010 -0700

    kernel - rewrite the LWKT scheduler's priority mechanism
    
    The purpose of these changes is to begin to address the issue of cpu-bound
    kernel threads.  For example, the crypto threads, or a HAMMER prune cycle
    that operates entirely out of the buffer cache.  These threads tend to hicup
    the system, creating temporary lockups because they never switch away due
    to their nature as kernel threads.
    
    * Change the LWKT scheduler from a strict hard priority model to
      a fair-share with hard priority queueing model.
    
      A kernel thread will be queued with a hard priority, giving it dibs on
      the cpu earlier if it has a higher priority.  However, if the thread
      runs past its fair-share quantum it will then become limited by that
      quantum and other lower-priority threads will be allowed to run.
    
    * Rewrite lwkt_yield() and lwkt_user_yield(), remove uio_yield().
      Both yield functions are now very fast and can be called without
      further timing conditionals, simplifying numerous callers.
    
      lwkt_user_yield() now uses the fair-share quantum to determine when
      to yield the cpu for a cpu-bound kernel thread.
    
    * Implement the new yield in the crypto kernel threads, HAMMER, and
      other places (many of which already used the old yield functions
      which didn't work very well).
    
    * lwkt_switch() now only round-robins after the fair share
      quantum is exhausted.  It does not necessarily always round robin.
    
    * Separate the critical section count from td_pri.  Add td_critcount.

Summary of changes:
 sys/ddb/db_ps.c                            |   47 +--
 sys/kern/kern_clock.c                      |    5 +
 sys/kern/kern_intr.c                       |    2 +-
 sys/kern/kern_kinfo.c                      |    2 +-
 sys/kern/kern_subr.c                       |    6 +-
 sys/kern/kern_synch.c                      |   37 +--
 sys/kern/kern_threads.c                    |    3 +-
 sys/kern/kern_time.c                       |    7 +-
 sys/kern/lwkt_ipiq.c                       |    8 +-
 sys/kern/lwkt_thread.c                     |  612 ++++++++++++++++------------
 sys/kern/lwkt_token.c                      |    4 +-
 sys/kern/usched_bsd4.c                     |    5 +-
 sys/kern/vfs_vnops.c                       |    4 +-
 sys/opencrypto/crypto.c                    |    2 +
 sys/platform/pc32/apic/apic_vector.s       |   24 +-
 sys/platform/pc32/i386/bcopy.s             |    8 +-
 sys/platform/pc32/i386/exception.s         |    2 +-
 sys/platform/pc32/i386/genassym.c          |    2 +-
 sys/platform/pc32/i386/machdep.c           |    6 +-
 sys/platform/pc32/i386/swtch.s             |    2 +-
 sys/platform/pc32/i386/trap.c              |   14 +-
 sys/platform/pc32/icu/icu_vector.s         |    8 +-
 sys/platform/pc32/isa/ipl.s                |   26 +-
 sys/platform/pc64/apic/apic_vector.s       |   24 +-
 sys/platform/pc64/icu/icu_vector.s         |    8 +-
 sys/platform/pc64/x86_64/exception.S       |    2 +-
 sys/platform/pc64/x86_64/genassym.c        |    2 +-
 sys/platform/pc64/x86_64/ipl.s             |   26 +-
 sys/platform/pc64/x86_64/machdep.c         |    6 +-
 sys/platform/pc64/x86_64/swtch.s           |    2 +-
 sys/platform/pc64/x86_64/trap.c            |   14 +-
 sys/platform/vkernel/i386/cpu_regs.c       |   10 +-
 sys/platform/vkernel/i386/exception.c      |   10 +-
 sys/platform/vkernel/i386/fork_tramp.s     |    2 +-
 sys/platform/vkernel/i386/genassym.c       |    2 +-
 sys/platform/vkernel/i386/swtch.s          |    2 +-
 sys/platform/vkernel/i386/trap.c           |   20 +-
 sys/platform/vkernel/platform/machintr.c   |    2 +-
 sys/platform/vkernel64/platform/machintr.c |    2 +-
 sys/platform/vkernel64/x86_64/cpu_regs.c   |   10 +-
 sys/platform/vkernel64/x86_64/exception.c  |   25 +-
 sys/platform/vkernel64/x86_64/fork_tramp.s |    2 +-
 sys/platform/vkernel64/x86_64/genassym.c   |    3 +-
 sys/platform/vkernel64/x86_64/swtch.s      |    2 +-
 sys/platform/vkernel64/x86_64/trap.c       |   20 +-
 sys/sys/globaldata.h                       |   10 +-
 sys/sys/thread.h                           |   29 +-
 sys/sys/thread2.h                          |   22 +-
 sys/sys/uio.h                              |    1 -
 sys/sys/upcall.h                           |    1 -
 sys/vfs/hammer/hammer_flusher.c            |    2 +-
 sys/vfs/ufs/ffs_rawread.c                  |   23 +-
 sys/vm/vm_zeroidle.c                       |    6 +-
 53 files changed, 586 insertions(+), 540 deletions(-)

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


-- 
DragonFly BSD source repository



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]