(mtx|sx)_init zeroed memory requirement plans?

Stephan Uphoff ups at stups.com
Thu Dec 25 12:58:08 PST 2003


Currently both mtx_init() and sx_init() make assumptions about the
lock memory passed in.	( KASSERT((lock->lo_flags & LO_INITIALIZED) == 0))

To fulfill this requirement current code that works with dynamically 
allocated memory routinely zeroes the lock memory space before
calling the lock initialization function.
( Or allocates zeroed memory)

Is this (undocumented?) behavior just a temporary debugging aid - or
will it stay around ?

If it is not going away anytime soon I would suggest adding 
MTX_PREPARE and SX_PREPARE macros instead of zeroing the lock memory.

This would make it easier to remove or optimize lock memory preparation
later on.


	Stephan




More information about the freebsd-hackers mailing list