tech-kern archive

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

re: Modules loading modules?

> On Tue Aug 03 2010 at 02:17:43 +1000, matthew green wrote:
> > > Now, on to sensible stuff.  I'm quite certain that warning was written
> > > to make people avoid writing bad code without understanding locking --
> > > if you need to used mutex_owned() to decide if you should lock a normal
> > > mutex, your code is broken.  The other less likely possibility is that
> > > someone plans to change mutex_owned in the future.
> > > 
> > > Further data point: the same warning is in rw_held, yet it was used to
> > > implement recursive locking in vlockmgr until its very recent demise.
> > > 
> > > Ignoring man page mantras and focusing on how the code works, I do not
> > > see anything wrong with Paul's use of mutex_owned().
> > 
> > this just does not match my actual experience in the kernel.  i had
> > weird pmap-style problems and asserts firing wrongly while i did not
> > obey the rules in the manual directly.
> Not knowing more details it's difficult to comment.  But since you are
> talking about the pmap, maybe your experiences are with spin mutexes
> instead of adaptive ones?

that could be it.  i certainly had different issues trying to use a
sleep-able lock in this code.

i find it confusing that mutex_owned() returns true if the mutex is
locked (regardless of who has it) for spin, where as adaptive only
returns true if this LWP has it locked.


Home | Main Index | Thread Index | Old Index