git: kernel - Rewrite lockmgr / struct lock

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Oct 21 11:23:43 PDT 2013


commit 05eacabc4af23ec82366095309047efe01dc1d6b
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Mon Oct 21 10:59:40 2013 -0700

    kernel - Rewrite lockmgr / struct lock
    
    * Rewrite lockmgr() to remove the exclusive spinlock used internally
      to guard operations.
    
    * Retain existing API and operational semantics.  This is primarily:
    
      - Acquiring a LK_SHARED lock on a lock the caller already owns
        exclusively simply bumps the count and retains the exclusive
        nature of the lock.
    
      - Exclusive requests and upgrade requests have priority over shared
        locks even if the lock is currently held shared, unless the thread
        is flagged for deadlock treatment.
    
      - Upgrade requests are capable of guaranteeing the upgrade (as before).
        This could be further enhanced because we now have the last release
        transfer the exclusive lock to the upgrade requestor, but the original
        API didn't have a function for this so neither do we.  The more
        primitive detection method is used (aka LK_SLEEPFAIL and/or
        LK_EXCLUPGRADE).
    
    * Reduce multiple tracking fields into one field so we can use
      atomic_cmpset_int().
    
    * Hot-path common operations.  A single atomic_cmpset_int() gets us
      through.

Summary of changes:
 sys/kern/kern_lock.c        | 873 +++++++++++++++++++++++---------------------
 sys/kern/vfs_lock.c         |   2 +-
 sys/kern/vfs_subr.c         |   2 +-
 sys/netproto/ncp/ncp_conn.c |   2 +-
 sys/sys/lock.h              |  46 +--
 sys/vm/swap_pager.c         |   6 +-
 6 files changed, 477 insertions(+), 454 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/05eacabc4af23ec82366095309047efe01dc1d6b


-- 
DragonFly BSD source repository


More information about the Commits mailing list