Re: brlock_is_locked()?

From: Brad Chapman (kakadu_croc@yahoo.com)
Date: Fri Aug 24 2001 - 09:11:03 EST


--- Jens Axboe <axboe@suse.de> wrote:
> On Wed, Aug 22 2001, Brad Chapman wrote:
> > > (I checked the brlock code and didn't find any schedule()s; there's
> > > probably a reason for that).
> > >
> > > Ummm, this is SMP 101, you can't sleep with a lock held.
> > > The global kernel lock is special in this regard, but all
> > > other SMP locking primitives may not sleep.
> >
> > Grrr....I read Rusty's Unreliable Guide to Kernel Locking (twice) and
> > still didn't remember that. Guess you have to schedule() yourself.
>
> Errr, like Dave said, _you cannot sleep while holding a lock_. It's not
> just that the locking primitives themselves don't sleep, you must not
> call schedule() (or any other function that may block/sleep) while
> holding a lock. _That's_ SMP 101 :-)
>
> --
> Jens Axboe

Mr. Axboe,

        Sorry, I was unclear in my statement. If we fail to grab the lock,
_then_ we sleep. If we succeed, we work our butts off, give the lock up,
and then schedule(). No sleeping on the lock job ;-)

Brad

=====
Brad Chapman

Permanent e-mail: kakadu_croc@yahoo.com
Current e-mail: kakadu@adelphia.net
Alternate e-mail: kakadu@netscape.net

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Aug 31 2001 - 21:00:09 EST