Date: Thu, 12 Jan 2017 09:19:09 +0800 (PHT)
From: Paul Goyette <paul%whooppee.com@localhost>
Currently, there's a long comment in src/sys/sys/mutex.h which reads in
part:
...
*
* MUTEX_OWNER(owner)
* Returns the owner of the adaptive mutex (LWP address).
*
* MUTEX_OWNED(owner)
* Returns non-zero if an adaptive mutex is currently
* held by an LWP.
*
...
It seems to me that the arguments of these two macros should be (mtx)
rather than (owner).
Am I misunderstanding something? Or should I fix it? :)
Actually, `owner' is correct. Specifically, these pick apart the bits
of the struct kmutex::mtx_owner field. Some of the bits make up a
pointer, either struct lwp * or struct cpu_info *, but in an aligned
pointer some bits are always zero, and those bits are used for other
purposes. See, e.g., the definition of mutex_owned in kern_mutex.c.