tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: New diagnostic routine - mutex_ownable()
In article <Pine.NEB.4.64.1704300840170.3617%speedy.whooppee.com@localhost>,
Paul Goyette <paul%whooppee.com@localhost> wrote:
>-=-=-=-=-=-
>
>While working on getting the localcount(9) stuff whipped into shape, I
>ran across a situation where it is desirable to ensure that the current
>process/lwp does not already own a mutex.
>
>We cannot use !mutex_owned() since that doesn't return the desired
>result for a spin mutex, so I'm proposing to add a new routine called
>mutex_ownable(). This does nothing in normal kernels, but for LOCKDEBUG
>kernels it does a mutex_enter() followed immediately by mutex_exit().
>If the current process already owns the mutex, the system will panic
>with a "locking against myself" error; otherwise mutex_ownable() just
>returns 1, enabling its use as
>
> KASSERT(mutex_ownable(mtx));
>
>Diffs are attached (including man-page and sets-list updates).
>
>Comments? Any reason why this cannot be committed?
>
>(Thanks to riastradh@ for the idea and initial review.)
How frequently is this going to be used and what is the performance
penalty for it. I am asking because I am running LOCKDEBUG all the time.
christos
Home |
Main Index |
Thread Index |
Old Index