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

Reminder on use of spinlocks


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 29 Aug 2010 22:28:10 -0700 (PDT)

    I've noticed a few situations where people are holding spinlocks
    across complex procedure calls such as kfree().  This is not legal.
    spinlocks can only be held across local code for very short
    duration.  Lockmgr locks, tokens, or mutexes should be used
    in more complex situations.

    With regards to locking up subsystems with tokens, I've notice a
    tad bit of blindly calling lwkt_gettoken()/reltoken in every
    procedure in a module.  Static procedures for which the token is
    already known to be held should assert that it is held instead of
    acquiring it recursively.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>



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