DragonFly commits List (threaded) for 2011-03
git: kernel - Refactor dsched ref/unref routines
Author: Matthew Dillon <firstname.lastname@example.org>
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(-)
DragonFly BSD source repository