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

git: kernel - Introduce hard code sections, simplify critical sections & mplocks

From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 28 Aug 2010 21:54:56 -0700 (PDT)

commit 4a28fe22d241d9ebd6072389b0d87650b332b579
Author: Matthew Dillon <dillon@apollo.backplane.com>
Date:   Sat Aug 28 21:07:08 2010 -0700

    kernel - Introduce hard code sections, simplify critical sections & mplocks
    * Introduce hard code sections with crit_enter_hard(), crit_exit_hard(),
      lwkt_gettoken_hard() and lwkt_reltoken_hard().
      These functions create a hard code section that, like an interrupt or ipi,
      does not allow any case which might potentially block or switch threads.
      While in a hard code section any such case will assert and panic the
      For example, acquiring a token that is not already held would be disallowed
      even if the acquisition could be accomplished without blocking.  However,
      acquiring a token which is already held would be allowed.  Same with the
      mplock, lockmgr locks, etc. (mtx's and serializers have not been dealt
      with yet).
      These assert that a token is held and a hard critical section (hard)
      or any critical section (crit) is in place.
    * Rework the critical section macros and optimize the crit_exit*() code
      to two conditionals which are usually always false regardless of
      whether critcount is transitioning 1->0 or not.  Also declare
      crit_panic() __dead2 which may produce better code.
    * Rework get_mplock() to reduce code generation.  The hard code section
      assertions would have made it too big.  We still optimize the case
      where the mplock is already held.

Summary of changes:
 sys/kern/kern_lock.c   |   39 ++++-----------
 sys/kern/kern_mplock.c |   22 ++++++++
 sys/kern/lwkt_thread.c |   44 +++++++++++++----
 sys/kern/lwkt_token.c  |   47 +++++++++++++++---
 sys/sys/globaldata.h   |    2 +-
 sys/sys/mplock2.h      |   16 ++----
 sys/sys/thread.h       |   38 +++++++++++++-
 sys/sys/thread2.h      |  128 ++++++++++++++++++++++++-----------------------
 sys/vm/vm_map.h        |    3 +
 9 files changed, 216 insertions(+), 123 deletions(-)


DragonFly BSD source repository

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