git: kernel - Refactor dsched ref/unref routines

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Mar 1 15:59:00 PST 2011


commit 265b0d4af67ddbef1cf048a4fd2783bfdec1795c
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Mar 1 15:52:19 2011 -0800

    kernel - Refactor dsched ref/unref routines
    
    * Refactor the dsched ref/unref routines to handle 1->0 transitions
      atomically and to properly deal with 1->0 races related to any
      re-referencing of the structure which can occur concurrently.
    
      Such races can occur because the structure must acquire other locks
      while removing itself from the various lists it is on and thus can
      be accessed via those lists in the mean time.
    
      Instead of using -0x400 as a separate atomic op after a 1->0 transition
      we directly transition from 1 to 0x80000000, removing a race condition.
    
      This also allows temporary references to be made during destruction.
    
    * Get a temporary ref and re-check flag state after acquiring a lock to
      determine if the structure in question is still on the list we are trying
      to remove it from.

Summary of changes:
 sys/kern/kern_dsched.c |  260 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 177 insertions(+), 83 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/265b0d4af67ddbef1cf048a4fd2783bfdec1795c


-- 
DragonFly BSD source repository





More information about the Commits mailing list