Reminder on use of spinlocks

Matthew Dillon dillon at apollo.backplane.com
Sun Aug 29 22:30:55 PDT 2010


    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 at backplane.com>





More information about the Kernel mailing list