git: kernel - RB_SCAN() requires a short-term spinlock

Matthew Dillon dillon at crater.dragonflybsd.org
Mon Nov 28 22:10:54 PST 2011


commit 5f97768d56d8f4feadf9407630849bdd67cad2f1
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Mon Nov 28 22:03:23 2011 -0800

    kernel - RB_SCAN() requires a short-term spinlock
    
    * RB_SCAN() links and unlinks an info structure.  If called with a shared
      lock the linking and unlinking operations requires a very short-term spin
      lock to avoid clobbering each other.
    
    * Note that RB_REMOVE() scans the inprog list but this function can only
      be safely called with the RB tree held exclusively anyway, so there's
      no need to spinlock the info list.
    
    * Add kern/subr_rbtree.c glue functions for acquiring and releasing the
      spinlock, so sys/tree.h only needs to include sys/spinlock.h and not
      also sys/spinlock2.h
    
    Reported-by: sephe

Summary of changes:
 sys/conf/files                           |    1 +
 sys/kern/{subr_shims.c => subr_rbtree.c} |   47 ++++++++++++++++--------------
 sys/sys/tree.h                           |   26 +++++++++++++++-
 3 files changed, 50 insertions(+), 24 deletions(-)
 copy sys/kern/{subr_shims.c => subr_rbtree.c} (74%)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/5f97768d56d8f4feadf9407630849bdd67cad2f1


-- 
DragonFly BSD source repository





More information about the Commits mailing list